HTML5學(xué)習(xí)(六):基礎(chǔ)標(biāo)簽(二)

基礎(chǔ)標(biāo)簽

  • 表格標(biāo)簽

  • 作用:用來給數(shù)據(jù)添加表格語義的醉旦。其實表格是一種數(shù)據(jù)展現(xiàn)形式九秀,數(shù)據(jù)量大的時候婚度,表格這種展現(xiàn)形式被認為是最清晰的一種展現(xiàn)形式皱卓。

  • 格式:
    <table boder=“100”> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </table>

  • 屬性:
    寬度和高度屬性 :可以給table標(biāo)簽和td標(biāo)簽使用

1.1表格的寬度和高度默認是按照內(nèi)容的尺寸來調(diào)整的。也可以通過table標(biāo)簽設(shè)置width/height屬性的方式來手動制定表格的寬度和高度
<able boder="100" width="500px" height="300px" align="center">
<tr valign="center">
<td width="150px" height="50px">1.1</td>
</tr>
<tr> 
</tr>
</table>

水平對齊和垂直對齊屬性:水平對齊可以給Table標(biāo)簽和Tr標(biāo)簽和Td標(biāo)簽使用;垂直標(biāo)簽只能給tr和td標(biāo)簽使用
外邊距和內(nèi)邊距的屬性:只能給Table標(biāo)簽使用.

 <able boder="100" width="500px" height="300px" align="center" cellspacing="12px" cellpadding="20px">
<tr valign="center">
<td width="150px" height="50px">1.1</td>
</tr>
</table>
  • 細線表格
  • 作用:就是讓表格只有一條線來展示
  • 格式:
<table bgcolor="black" cellspacing="1px">
<tr bgcolor="white">
<td>1.1</td>
<td>1.2</td>
</tr>
<tr bgcolor="white">
<td>2.1</td>
<td>2.2</td>
</tr>
</table>
  • caption 標(biāo)簽
    • 作用:讓標(biāo)簽內(nèi)部的內(nèi)容居中
    • 格式:
    <table bgcolor="black" cellspacing="2px" width="1000px" align="center">
    

<caption>
<h1>新聞大事件</h1>
</caption>
<tr bgcolor="#b8b8b8">
<th>中國崛起</th>
<th>中國崛起</th>
<th>中國崛起</th>
<th>中國崛起</th>
<th>中國崛起</th>
</tr>
</table>

- 表格的結(jié)構(gòu)
- 標(biāo)題
- 表頭信息
- 主題信息
- 頁尾信息

<table>
<caption>表格的標(biāo)題</caption>
<thead>
<tr>
<th>每一列標(biāo)題</th>
</tr>
</thead>
<tbody>
<tr>
<th>數(shù)據(jù)</th>
</tr>
</tbody>
<tfooty>
<tr>
<th>表尾數(shù)據(jù)</th>
</tr>
</tfoot>
</table>

- 單元格合并
 - 水平方向的單元格合并

<table bgcolor="black" width="2px" height= "1000px" align="center">
<tr bgcolor="while">
<td colspan="2"></td> // 代表水平方向上的融合
<td></td>
<td></td>
</tr>
<tr bgcolor="while">
<td></td>
<td></td>
<td></td>
</tr>
</table>

 - 垂直方向的單元格合并

<table bgcolor="black" width="2px" height= "1000px" align="center">
<tr bgcolor="while">
<td rowspan="2"></td> // 代表垂直方向上的融合
<td></td>
<td></td>
</tr>
<tr bgcolor="while">
<td></td>
<td></td>
<td></td>
</tr>
</table>

 - 多單元格合并

<table bgcolor="black" cellpadding="10px" cellspacing="1px" width="300px" height="300px" align="center">
<tr bgcolor="white">
<td>345</td>
<td >345</td>
<td>345</td>
</tr>
<tr bgcolor="#adff2f">
<td >123</td>
<td colspan="2" rowspan="2">123</td>
</tr>
<tr bgcolor="#adff2f">
<td>153</td>
</tr>
<tr bgcolor="#adff2f">
<td>123</td>
<td>123</td>
<td>123</td>
</tr>
</table>


![多單元格合并](http://upload-images.jianshu.io/upload_images/642887-4a2a613b8cbbfeac.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
- 表單標(biāo)簽
 - 作用:
   收集用戶信息
 - 元素:
  在HTML中標(biāo)簽就是元素恨搓,表單元素是比較特殊的標(biāo)簽院促。
 - 格式:

<form><表單元素></form>
表單元素
<input type=“text”>標(biāo)簽

 - 常用方式:

<form>
賬號:<input type="text">

密碼:<input type="password">
// name="gender" 起名字就是讓其只能選擇一個,checked表示默認選中斧抱,type="radio"表示單選
性別:<input type="radio" name="gender" checked="checked">男
<input type="radio" name="gender">女
// 多選
愛好<input type="checkbox" checked="checked">中國 <input type="checkbox">足球 <input type="checkbox">牛逼
<input type="button" value="點擊跳轉(zhuǎn)">
<input type="image" src="image/pic.png">
<input type="reset" value="清空">
<input type="number">
<input type="data">
<input type="color">
<input type="email">
</form>
//提交方式
<form action="http://www.reibang.com">
賬號:<input type="text">

密碼:<input type="password">

// 將表單中填好的數(shù)據(jù)常拓,提交到服務(wù)器
<input type="submit" value="提交">
// 隱藏域,其實就是隱藏數(shù)據(jù)提交
<input type="hidden" name="cc" value="kuku">
</form>

- Lable標(biāo)簽
 - 格式

<form action="">
<lable for="account">賬號:</lable><input type="text" id="account">
<lable>賬號:<input type="text">
</lable>


</form>

- select標(biāo)簽
 - 作用:用于定義下拉列表
 - 格式:

<select>
<option>北京</option>
<option>北京</option>
<option>北京</option>
<option>北京</option>
</select>

- datalist標(biāo)簽
 - 作用:下拉選框辉浦,可以自己輸入內(nèi)容弄抬,同時還會幫助你篩選輸入內(nèi)容是否與下拉框有相同的。
 - 格式:

請輸入你的車型:<input type="text" list="cars">
<datalist id="cars">
<option >車型</option>
<option>徹心</option>
<option >輸電</option>
</datalist>

![image.png](http://upload-images.jianshu.io/upload_images/642887-d5696cf8f324c6f1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

  - 其他用法:

請輸入你的車型:<input type="text" list="cars">
<datalist id="cars">
<option value="123">車型</option>
<option value="345">徹心</option>
<option value="678">輸電</option>
</datalist>

![image.png](http://upload-images.jianshu.io/upload_images/642887-8ff0c71c0f2a374f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

- select標(biāo)簽
 - 作用:生成一個下拉選項宪郊,但是不可以書寫內(nèi)容
 - 格式:

<select>
<option>朋友圈</option>
<option>支付寶</option>
<option>全資氣</option>
</select>

![image.png](http://upload-images.jianshu.io/upload_images/642887-884f9706464a3244.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
  - 其他用法

<select>
<optgroup label="騰訊">
<option>深圳總部</option>
<option>北京總部</option>
<option>上旱嗨。總部</option>
</optgroup>
<optgroup label="百度">
<option>北京百度</option>
<option>廣州百度</option>
<option>深圳百度</option>
</optgroup>
</select>

![image.png](http://upload-images.jianshu.io/upload_images/642887-81c5ee8d617cc9d5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

- textarea標(biāo)簽
 - 作用:定義多行的輸入框,默認就有拉伸的功能
 - 格式:

<head>
<meta charset="UTF-8">
<title>datalist</title>
<style type="text/css">
textarea{ // 不讓它拉伸
resize: none;
}
</style>
<textarea cols="3" rows="3">
</textarea>

 - 注意點:雖然指定了行數(shù)烈數(shù)废膘,但是還是可以無線輸入
   `&nbsp;` 這個用來空格

<form action="http://www.taobao.com">
<fieldset>
<legend>雷潮博客</legend>
姓名:<input value="name" type="text">

密碼:<input value="密碼" type="password">

<p>
性別:<input type="radio" name="sex" >男
<input type="radio" name="sex">女
<input type="radio" name="sex" checked>保密
</p>
<p>
個人簡介:<textarea></textarea>
</p>
<p>
<input type="submit" value="提交">???&nbsp <input type="reset" value="重置">
</p>
</fieldset>
</form>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末竹海,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子丐黄,更是在濱河造成了極大的恐慌,老刑警劉巖孔飒,帶你破解...
    沈念sama閱讀 219,539評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件灌闺,死亡現(xiàn)場離奇詭異,居然都是意外死亡坏瞄,警方通過查閱死者的電腦和手機桂对,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,594評論 3 396
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來鸠匀,“玉大人蕉斜,你說我怎么就攤上這事∽汗鳎” “怎么了宅此?”我有些...
    開封第一講書人閱讀 165,871評論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長爬范。 經(jīng)常有香客問我父腕,道長,這世上最難降的妖魔是什么青瀑? 我笑而不...
    開封第一講書人閱讀 58,963評論 1 295
  • 正文 為了忘掉前任璧亮,我火速辦了婚禮萧诫,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘枝嘶。我一直安慰自己帘饶,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 67,984評論 6 393
  • 文/花漫 我一把揭開白布群扶。 她就那樣靜靜地躺著尖奔,像睡著了一般。 火紅的嫁衣襯著肌膚如雪穷当。 梳的紋絲不亂的頭發(fā)上提茁,一...
    開封第一講書人閱讀 51,763評論 1 307
  • 那天,我揣著相機與錄音馁菜,去河邊找鬼茴扁。 笑死,一個胖子當(dāng)著我的面吹牛汪疮,可吹牛的內(nèi)容都是我干的峭火。 我是一名探鬼主播,決...
    沈念sama閱讀 40,468評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼智嚷,長吁一口氣:“原來是場噩夢啊……” “哼卖丸!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起盏道,我...
    開封第一講書人閱讀 39,357評論 0 276
  • 序言:老撾萬榮一對情侶失蹤稍浆,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后猜嘱,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體衅枫,經(jīng)...
    沈念sama閱讀 45,850評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,002評論 3 338
  • 正文 我和宋清朗相戀三年朗伶,在試婚紗的時候發(fā)現(xiàn)自己被綠了弦撩。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,144評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡论皆,死狀恐怖益楼,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情点晴,我是刑警寧澤感凤,帶...
    沈念sama閱讀 35,823評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站觉鼻,受9級特大地震影響俊扭,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜坠陈,卻給世界環(huán)境...
    茶點故事閱讀 41,483評論 3 331
  • 文/蒙蒙 一萨惑、第九天 我趴在偏房一處隱蔽的房頂上張望捐康。 院中可真熱鬧,春花似錦庸蔼、人聲如沸解总。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,026評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽花枫。三九已至,卻和暖如春掏膏,著一層夾襖步出監(jiān)牢的瞬間劳翰,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,150評論 1 272
  • 我被黑心中介騙來泰國打工馒疹, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留佳簸,地道東北人。 一個月前我還...
    沈念sama閱讀 48,415評論 3 373
  • 正文 我出身青樓颖变,卻偏偏與公主長得像生均,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子腥刹,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,092評論 2 355

推薦閱讀更多精彩內(nèi)容