HTML的一些標籤

1. 一些簡單的標籤:

<p>段落標籤</p>

<br/>換行標籤

<ul>無序列表標籤</ul>

    <li>表示該無序列表的一個列表項</li>

<ol>有序列表標籤</ol>

<img src="1.png" /> 引入圖片

<a href="http://www.baidu.com">這是個鏈接</a>

<a href="http://www.baidu.com" target="_self">跳轉後的頁面,在當前頁面打開</a>

<a href="http://www.baidu.com" target="_blank">跳轉後的頁面,在另一個頁面打開</a>

2. 表格標籤:

<table border="1" width="400">
    <tr>
        <th>姓名</th>
        <th>年齡</th>
    </tr>
    <tr>
        <td>張三</td>
        <td>15</td>
    </tr>
</table>
<!--
    table標籤是表格標籤,創建1個表格;
    border屬性:邊框(默認單位px); width屬性:表格的寬;
    tr標籤表示創建1行;td標籤表示創建1個單元格;th標籤表示表頭;
    rowspan跨行合併;colspan跨列合併
-->

例子:

<table border="1" width="400">
	<tr>
		<th>姓名</th>
		<th>年齡</th>
		<th>id</th>
	</tr>
	<tr>
		<td>張三</td>
		<td rowspan="2">28</td>
		<td>1</td>
	</tr>
	<tr>
		<td>李四</td>
		<td>2</td>
	</tr>
	<tr>
		<td>王五</td>
		<td colspan="2">15</td>
	</tr>
</table>

呈現出的表格:

3. form表單

<form action="success.html">
	username: <input type="text" name="uname"/>
        username: <input type="text" name="uname2" value="admin默認值"/><br />
	password: <input type="password" name="pwd"/><br />
        性別:男<input type="radio" name="gender" value="male"/>  女<input type="radio" name="gender" value="female"/><br />
	<input type="reset" value="清空"/>
	<input type="submit" value="提交"/>
</form>
<!--
    form是表單標籤:
    action屬性:表單要提交的地址,這裏是提交到"success.html";
    input標籤:用來創建1個表單項,不會換行;
        name屬性:如果希望表單項的數據能夠被表單收集提交給服務器,必須添加name屬性;最後,name屬性和用戶輸入的值組成鍵值對進行提交;
        value屬性:凡是用戶不能直接輸入的表單項,需要提供一個value屬性值,服務器會使用此值;
        type屬性:決定input的功能和樣式(text、password、reset、submit);    
-->

text:普通文本框

password:密碼框,輸入內容會做隱藏處理

reset:重置按鈕

submit:提交按鈕,點擊此按鈕表單會自動收集所有name屬性值的表單項數據提交給form標籤的action屬性值的資源

radio:單選框,相同的name屬性值決定多個radio按鈕是否是同一組

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章