.html 或 .htm 結尾的文件可直接打開渲染。<html><head>...</head><body>...</body></html>| 標簽 | 說明 | 關鍵屬性 |
|---|---|---|
<br/> | 換行 | - |
<hr/> | 水平線 | color、width(px/%) |
<p></p> | 段落,前後各空一行 | align |
<div></div> | 塊級區域,自帶換行 | id、class、style |
<span></span> | 行內區域,不換行 | id、class、style |
| 標簽 | 說明 | 屬性 |
|---|---|---|
<font></font> | 字體設置(HTML5 棄用,建議用 CSS) | color、size(1-7)、face |
<h1>~<h6> | 標題,遞減 | align |
<b>/<i> | 粗體/斜體,可嵌套 | - |
< → < | > → > | & → & | 空格 →
<ul><li>...</li></ul>(type: disc/circle/square)<ol><li>...</li></ol>(type: 1/a/A/i/I,start 指定起始)<dl><dt>術語</dt><dd>描述</dd></dl><img src="url" width="px" height="px" alt="說明" /> <a href="url" target="_blank|_self|_parent|_top">文本/圖片</a> <a name="anchor">錨點</a> <a href="#anchor">頁內跳轉</a>
注意:href 必須包含協議(https://),否則默認 file 協議。
<table border="1" width="500" cellpadding="5"> <caption>標題</caption> <tr align="center"><th>表頭</th><th>表頭</th></tr> <tr><td>單元格</td><td rowspan="2">跨行</td></tr> <tr><td colspan="2">跨列</td></tr> </table>
<th> 默認居中加粗,<td> 普通單元格。
<form action="/submit" method="post"> <input type="text" name="username" value="" /> <input type="password" name="pwd" /> <input type="radio" name="sex" value="male" checked="checked" />男 <input type="checkbox" name="hobby" value="read" />閱讀 <input type="file" name="avatar" /> <input type="hidden" name="id" value="100" /> <select name="city"><option value="bj">北京</option></select> <textarea name="desc" rows="5" cols="30"></textarea> <input type="submit" value="提交" /> <input type="reset" value="重置" /> </form>
GET vs POST:GET 參數顯示地址欄、有長度限制、安全性低;POST 無長度限制、參數在請求體、相對安全。
關鍵:name 屬性必須指定,否則提交時不會攜帶該字段。
<frameset> 不能置於 <body> 內,現代開發用 iframe 或 SPA 路由替代。
<h1> 而非 <font size=7>)。