常見的meta標簽
meta標簽是表示元數據(MetaData)的標簽,元數據是描述數據的數據。meta常用于定義頁面的說明、關鍵字,最后修改日期和其他的元數據;這些元數據服務于瀏覽器,搜索引擎和其他網絡服務。
meta標簽共有兩個屬性:
name屬性
主要用于描述網頁,比如網頁的關鍵詞、敘述等。與之對于的屬性值為content,content中的內容是對name填入類型的具體描述,便于搜索引擎抓取。語法格式:
<meta name="參數" content="具體的描述">
常見參數:
<meta name="keywords" content="xxx,博客,前端"> 告訴搜索引擎網頁的關鍵字
<meta name="description" content="文科生,熱愛前端與編程"> 告訴搜索引擎網站的主要內容
<meat name="viewport" content="width=device-width,initial-scale=1"> 用于移動端
http-equiv屬性 (http-equivalent)
具體語法:
<meta http-equiv="參數" content="具體的描述">
常見參數
<meta http-equiv="content-Type" content="text/html;charset=utf-8"> //舊的HTML,不推薦
<meat charset="utf-8"> //HTML5設定網頁字符集的方式,推薦使用UTF-8
<meat http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 指定IE和Chrome使用最新版本渲染當前頁面
<meat http-equiv="cache-control" content="no-cache"> 先發送請求,與服務器確認該資源是否被更改,如果未被更改,則使用緩存
<meat http-equiv="cache-control" content="no-store"> 不允許緩存,每次都要去服務器上,下載完整的響應。(安全措施)
<meat http-equiv="cache-control" content="public"> 緩存所有響應,max-age可以做到相同效果
<meat http-equiv="cache-control" content="private"> 只為單個用戶緩存,因此不允許任何中繼進行緩存(比如說CDN就不允許緩存private的響應)
<meat http-equiv="cache-control" content="maxage"> 表示當前請求開始,該響應在多久內能被緩存和重用,而不去服務器重新請求。例如:max-age=60,表示響應可以再緩存和重用60妙
<meat http-equiv="cache-control" content="no-siteapp"> 禁止百度自動轉碼
<meat http-equiv="refresh" content="2;URL=http://www.baidu.com/"> 2秒后刷新,并跳向百度
其他標簽
標題標簽
h1 必須從h1開始
h2
h3
h4
h5
h6
段落標簽
<p>段落內容</p>
超鏈接
<a href="www.google.com.hk" title="超鏈接描述"></a>
img 圖像

有序列表
<ol>
<li></li>
<li></li>
<li></li>
<li></li>
</ol>
無序列表
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
定義列表
<dl>
<dt>width</dt>
<dd>0</dd>
<dd>50px</dd>
<dd>100px</dd>
<dt>顏色</dt>
<dd>white</dd>
<dd>green</dd>
<dd>black</dd>
</dl>
表格
<table>
<tr>
<th>姓名</th>
<th>年齡</th>
<th>性別</th>
</tr>
<tr>
<td>小明</td>
<td>29</td>
<td>男</td>
</tr>
<tr>
<td>小紅</td>
<td>18</td>
<td>女</td>
</tr>
表單
<form action="">
<input type="text">
<input type="password">
</form>
按鈕
<button>start!</button>
內聯框架(內嵌網頁)
<iframe src="http://www.baidu.com/" frameborder="0"></iframe>
div(一塊內容,塊級)
<div></div>
span(一塊內容,行內)
<span></span>
em(強調語義)
<em></em>
strong(著重強調)
<strong></strong>