Table of Contents generated with DocToc
<body> 頁(yè)面內(nèi)容 <header> 文檔頭部
頁(yè)面通常結(jié)構(gòu)
<!-- 默認(rèn)超鏈接 -->
<a rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" title="Sample Link">Sample</a>
<!-- 當(dāng)前窗口顯示 -->
<a rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" title="Sample Link" target="_self">Sample</a>
<!-- 新窗口顯示 -->
<a rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" title="Sample Link" target="_blank">Sample</a>
<!-- iframe 中打開(kāi)鏈接 -->
<a rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" title="Sample Link" target="iframe-name">Sample</a>
<iframe name="iframe-name" frameborder="0"></iframe>
<!-- 頁(yè)面中的錨點(diǎn) -->
<a href="#achor">Achor Point</a>
<section id="achor">Achor Content</section>
<!-- 郵箱及電話需系統(tǒng)支持 -->
<a href="mailto:sample-address@me.com" title="Email">Contact Us</a>
<!-- 多個(gè)郵箱地址 -->
<a href="mailto:sample-address@me.com, sample-address0@me.com" title="Email">Contact Us</a>
<!-- 添加抄送,主題和內(nèi)容 -->
<a href="mailto:sample-address@me.com?cc=admin@me.com&subject=Help&body=sample-body-text" title="Email">Contact Us</a>
<!-- 電話示例 -->
<a href="tel:99999999" title="Phone">Ring Us</a>
<body> 頁(yè)面內(nèi)容 <header> 文檔頭部 <nav> 導(dǎo)航 <aside> 側(cè)邊欄 <article> 定義外部?jī)?nèi)容(如外部引用的文章) <section> 一個(gè)獨(dú)立的塊 <footer> 尾部
<pre>
<code>
int main(void) {
printf('Hello, world!');
return 0;
}
</code>
</pre>
<code> 引用代碼
<b> 加粗 <i> 斜體
<em> 斜體。著重于強(qiáng)調(diào)內(nèi)容,會(huì)改變語(yǔ)義的強(qiáng)調(diào) <strong> 粗體。著重于強(qiáng)調(diào)內(nèi)容的重要性
<br> 換行
無(wú)序列表
<ul>
<li>標(biāo)題</li>
<li>結(jié)論</li>
</ul>
有序列表
<ol>
<li>第一</li>
<li>第二</li>
</ol>
自定義列表
<dl>
<dt>作者</dt>
<dd>愛(ài)因斯坦</dd>
<dt>作品</dt>
<dd>《相對(duì)論》</dd>
<dd>《時(shí)間與空間》</dd>
</dl>
一個(gè)<dt>可以對(duì)應(yīng)多個(gè)<dd>
NOTE: <dl> 為自定義列表,其中包含一個(gè)或多個(gè) <dt> 及 一個(gè)或多個(gè) <dd>,并且dt 與 dl列表會(huì)有縮進(jìn)的效果。<pre> 會(huì)保留換行和空格,通常與 <code> 一同使用。
<pre>
<code>
int main(void) {
printf('Hello, world!');
return 0;
}
</code>
</pre>
<blockquote> 擁有 cite 屬性,它包含引用文本的出處,示例如下所示:
<blockquote cite="http://example.com/facts">
<p>Sample Quote...</p>
</blockquote>
<iframe src=""></iframe> 頁(yè)面操作可以不影響到iframe的內(nèi)容
<!--object embed通常用來(lái)嵌入外部資源 -->
<object type="application/x-shockwave-player">
<param name="movie" value="book.pdf">
</object>
<!--視頻 track可以引入字幕 autoplay可以使視頻加載后自動(dòng)播放,loop可以使其循環(huán)播放 -->
<video autoplay loop controls="controls" poster="poster.jpg">
<source src="movie.mp4" type="video/mp4">
<source src="movie.webm" type="video/webm">
<source src="movie.ogg" type="video/ogg">
<track kind="subtitles" src="video.vtt" srclang="cn" label="cn">
</video>
canvas 基于像素,性能要求比較高,可用于實(shí)時(shí)數(shù)據(jù)展示。svg 為矢量圖形圖像。
img中套用map以及area可以實(shí)現(xiàn)點(diǎn)擊某部分圖片觸發(fā)一個(gè)鏈接,點(diǎn)擊另一部分觸發(fā)另一個(gè)鏈接
<img src="mama.jpg" width=100 height=100 usemap="#map" />
<map name="map">
<area shap="rect" coords="0,0,50,50" href="" alt="">
<area shap="circle" coords="75,75,25" href="" alt="">
</map>
表格代碼示例
<table>
<caption>table title and/or explanatory text</caption>
<thead>
<tr>
<th>header</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
</tr>
</tbody>
</table>
使用 colspan=val 進(jìn)行跨列,使用 rowspan=val 進(jìn)行跨行。
<form action="WebCreation_submit" method="get" accept-charset="utf-8">
<fieldset>
<legend>title or explanatory caption</legend>
<!-- 第一種添加標(biāo)簽的方法 -->
<label><input type="text/submit/hidden/button/etc" name="" value=""></label>
<!-- 第二種添加標(biāo)簽的方法 -->
<label for="input-id">Sample Label</label>
<input type="text" id="input-id">
</fieldset>
<fieldset>
<legend>title or explanatory caption</legend>
<!-- 只讀文本框 -->
<input type="text" readonly>
<!-- 隱藏文本框,可提交影藏?cái)?shù)據(jù) -->
<input type="text" name="hidden-info" value="hiden-info-value" hidden>
</fieldset>
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</form>
使用fieldset可用于對(duì)表單進(jìn)行分區(qū)
表單中的其他控件類(lèi)型:
Value | Description |
---|---|
button | Defines a clickable button (mostly used with a JavaScript to activate a script) |
checkbox | Defines a checkbox |
color | Defines a color picker |
date | Defines a date control (year, month and day (no time)) |
datetime | The input type datetime has been removed from the HTML standard. Use datetime-local instead. |
datetime-local | Defines a date and time control (year, month, day, hour, minute, second, and fraction of a second (no time zone) |
Defines a field for an e-mail address | |
file | Defines a file-select field and a "Browse..." button (for file uploads) |
hidden | Defines a hidden input field |
image | Defines an image as the submit button |
month | Defines a month and year control (no time zone) |
number | Defines a field for entering a number |
password | Defines a password field (characters are masked) |
radio | Defines a radio button |
range | Defines a control for entering a number whose exact value is not important (like a slider control) |
reset | Defines a reset button (resets all form values to default values) |
search | Defines a text field for entering a search string |
submit | Defines a submit button |
tel | Defines a field for entering a telephone number |
text | Default. Defines a single-line text field (default width is 20 characters) |
time | Defines a control for entering a time (no time zone) |
url | Defines a field for entering a URL |
week | Defines a week and year control (no time zone) |
語(yǔ)義化(Semantic Tag)是指用合適的標(biāo)簽標(biāo)識(shí)適當(dāng)?shù)膬?nèi)容,它可以起到搜索引擎優(yōu)化(Search Engine Optimization),提高可訪問(wèn)性(例如盲人使用的屏幕閱讀器),與此同時(shí)還可以提高代碼的可讀性。簡(jiǎn)而言之也就是在正確的地方使用正確的標(biāo)簽
更多建議: