day02-HTML基礎下

知識點一:

HTML5的標準結構:

<!DOCTYPE html>
<html lang='en'>
<head>
    <meat charset='utf-8'>
    <title>Document</title>
</head>
<body>
</body>
</html>

meta的其他示例:
關鍵字:

<meta name='keywords' content=''>

將網頁內容提出關鍵字告訴搜索引擎,利於seo排名,content的內容用”,”隔開。

網頁描述:

<meta name='description' content=''> 

用於檢索出來的網頁描述使用。用於seo查看。

網頁重定向:

<meta http-equiv='refresh' content='5;http://www.baidu.com'>

實現域名跳躍,即可以註冊多個域名,然後跳到同一個域名即可。

link標籤:
鏈接外部樣式表文件:

<link rel='stylesheet' href=''>

設置icon圖標:

<link rel='icon' href=''>

知識點二:表格:

標準結構

<table border='' width='' height='' cellspacing='' cellpadding='' align='' bgcolor=''>
    <thead>
        <tr>
            <td>姓名</td>
            <td>年齡</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>趙靈兒</td>
            <td>18</td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td>林月如</td>
            <td>18</td>
        </tr>
    </tfoot>
</table>

屬性:
border:邊框粗細。
width:表格寬度。
height:高度。
cellspacing:單元格與單元格的距離
cellpadding:內容距邊框的距離
align:left、right、center表格的排列方式,居左,居右,居中。
bgcolor:背景顏色。
屬性rowsapn:合併同一列上的單元格。
屬性colspan:合併同一行上的單元格。
表格標題:<th></th>用法跟<td></td>一樣
邊框顏色:屬性bordercolor
內容垂直對齊:<td>屬性valign=top、middle、bottom。

知識點三:表單

表單域<form action='' method=''>
action:處理方式,其實就是訪問地址。
method:get/post
文本輸入框:

<input type='text' maxlength='' readonly='readonly' disable='disable' name='username' value='內容'>

maxlength=”6” 限制輸入字符長度
readonly=”readonly” 將輸入框設置爲只讀狀態(不能編輯)
disabled=”disabled” 輸入框未激活狀態
name=”username” 輸入框的名稱
value=”內容” 將輸入框的內容傳給處理文件

密碼輸入框:

<input type='password' name='password'>

屬性同文本輸入框一致。

單選框:

<input type='radio' name='gender' checked='checked'>男
<input type='radio' name='gender' >女

只有當name相同時,才能實現單選效果。
checked屬性爲默認選中。

下拉框:

<select multiple='multiple'>
    <optgroup label='北京市'>
        <option>昌平區</option>
        <option>海淀區</option>
        <option>朝陽區</option>
        <option selected='selected'>大興區</option>
    </optgroup>
</select>

Multiple=”multiple” 將下拉列表設置爲多選項
Selected=”selected” 設置默認選中項目
<optgroup></optgroup> 對下拉列表進行分組。
Label=”” 分組名稱。

多選框

<input type='checkbox' checked='checked'>多選1
<input type='checkbox' >多選2
<input type='checkbox' >多選3

checked表示默認選中。

多行文本框:

<textarea cols='130' rows='10'></textarea>

cols:控制輸入字符的長度。
rows:控制輸入字符的行數。

文件上傳控件:

<input type='file'>

提交按鈕:

<input type='submit'>

可以直接實現提交

普通按鈕:

<input type='button' >

沒有功能,需要配合js使用

重置按鈕:

<input type='reset'>

可以重置表單信息

圖片按鈕:

<input type='image' src=''>

圖片按鈕也可以實現信息提交功能。

給表單實現分組:

<fieldset></fieldset>
<legend>分組信息<legend>

對錶單信息分組
表單信息分組名稱

html5補充表單控件
這裏寫圖片描述

知識點四:標籤語義化

好的語義化的網站標準就是去掉樣式表文件之後,結構依然很清晰。
標籤語義化概念:根據內容的結構化(內容語義化),選擇合適的標籤(代碼語義化)

-標籤語義化意義:
1:網頁結構合理
2:有利於seo:和搜索引擎建立良好溝通,有了良好的結構和語 義你的網頁內容自然容易被搜索引擎抓取;
3:方便其他設備解析(如屏幕閱讀器、盲人閱讀器、移動設備)
4:便於團隊開發和維護

1:儘可能少的使用無語義的標籤div和span;

2:在語義不明顯時,既可以使用div或者p時,儘量用p, 因爲p在默認情況下有上下間距,對兼容特殊終端有利;

3:不要使用純樣式標籤,如:b、font、u等,改用css設置。

4:需要強調的文本,可以包含在strong或者em標籤中strong默認樣式是加粗(不要用b),em是斜體(不用i);

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