html参考手册:http://www.w3school.com.cn/tags/index.asp
全局属性:http://www.w3school.com.cn/tags/html_ref_standardattributes.asp
事件属性:http://www.w3school.com.cn/tags/html_ref_eventattributes.asp
<hr />创建水平线
文本格式化:
<b>粗体</b>
<big>大号字</big>
<small>小号字</small>
<em>着重字</em>
<i>斜体字</i>
<strong>着重语气</strong>
<sub>下标字</sub>
<sup>上标字</sup>
<ins>插入字</ins>
<del>删除字</del>
<code>计算机代码</code>
<kdb>键盘码</kdb>
<samp>计算机代码样本</samp>
<tt>打字机代码</tt>
<var>变量</var>
<pre>预格式文本</pre>
<abbr>缩写</abbr>
<address>地址</address>
<bdo>文字方向</bdo>
<blockquote>长的引用</blockquote>
<q>短的引用</q>
<cite>引用</cite>
<link rel="stylesheet" type="text/css" href="style.css" />
链接:
<a href="mailto:someone@microsoft.com?subject=Hello%20again">发送邮件</a>
使用 %20 来替换单词之间的空格,这样浏览器就可以正确地显示文本了
链接:target:
值 | 描述 |
---|---|
_blank | 在新窗口中打开被链接文档。 |
_self | 默认。在相同的框架中打开被链接文档。 |
_parent | 在父框架集中打开被链接文档。 |
_top | 在整个窗口中打开被链接文档。 |
图像:
通过align来设置文本中图片的显示,默认:align="bottom"
alt: 图
带有可点击区域的图像映射:
<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" />像可替换文本<map name="planetmap" id="planetmap">
<area shape="circle" coords="180,139,14" href ="venus.html" alt="Venus" /> <area shape="circle" coords="129,161,10" href ="mercur.html" alt="Mercury" /> <area shape="rect" coords="0,0,110,260" href ="sun.html" alt="Sun" /></map>
表格:
带有 thead、tbody 以及 tfoot 元素的 HTML 表格:
<table border="1"><thead valign="middle"> valign 属性规定 thead 元素中的内容的垂直对齐方式。
<tr> <th>Month</th> <th>Savings</th> </tr></thead>
<tfoot> <tr> <td>Sum</td> <td>$180</td> </tr> </tfoot> <tbody> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </tbody> </table>
cellpadding: 单元边沿与内容之间的空白
cellspacing: 单元格之间的空白
列表:
无序列表:<ul><li> </li></ul>
有序列表:<ol><li></li></ol> 属性:start type
定义列表:<dl><dt></dt><dd></dd></dl>
框架:
<frameset cols="25%,75%"> <frame src="frame_a.htm"> <frame src="frame_b.htm"> </frameset>内联框架
<iframe src="URL"></iframe>
颜色:
Color | Color HEX | Color RGB |
---|---|---|
#000000 | rgb(0,0,0) | |
#FF0000 | rgb(255,0,0) | |
#00FF00 | rgb(0,255,0) | |
#0000FF | rgb(0,0,255) | |
#FFFF00 | rgb(255,255,0) | |
#00FFFF | rgb(0,255,255) | |
#FF00FF | rgb(255,0,255) | |
#C0C0C0 | rgb(192,192,192) | |
#FFFFFF | rgb(255,255,255) |
头部
<base> 标签为页面上的所有链接规定默认地址或默认目标(target):
<head> <base href="http://www.w3school.com.cn/images/" /> <base target="_blank" /> </head>
<link> 标签定义文档与外部资源之间的关系。
<link> 标签最常用于连接样式表:
<head> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head>
HTML <meta> 元素
元数据(metadata)是关于数据的信息。
<meta> 标签提供关于 HTML 文档的元数据。元数据不会显示在页面上,但是对于机器是可读的。
典型的情况是,meta 元素被用于规定页面的描述、关键词、文档的作者、最后修改时间以及其他元数据。
<meta> 标签始终位于 head 元素中。
元数据可用于浏览器(如何显示内容或重新加载页面),搜索引擎(关键词),或其他 web 服务。
<noscript> 标签提供无法使用脚本时的替代内容,比方在浏览器禁用脚本时,或浏览器不支持客户端脚本时。
只有在浏览器不支持脚本或者禁用脚本时,才会显示 noscript 元素中的内容:
<script type="text/javascript"> document.write("Hello World!") </script><noscript>
Your browser does not support JavaScript!</noscript>
HTML 中有用的字符实体
注释:实体名称对大小写敏感!
显示结果 | 描述 | 实体名称 | 实体编号 |
---|---|---|---|
空格 | |   | |
< | 小于号 | < | < |
> | 大于号 | > | > |
& | 和号 | & | & |
" | 引号 | " | " |
' | 撇号 | ' (IE不支持) | ' |
¢ | 分 | ¢ | ¢ |
£ | 镑 | £ | £ |
¥ | 日圆 | ¥ | ¥ |
€ | 欧元 | € | € |
§ | 小节 | § | § |
© | 版权 | © | © |
® | 注册商标 | ® | ® |
™ | 商标 | ™ | ™ |
× | 乘号 | × | × |
÷ | 除号 | ÷ | ÷ |
表单:
带边框的表单:
<form>
<fieldset>
<legend>健康信息</legend>
身高:<input type="text" />
体重:<input type="text" />
</fieldset>
</form>
例子:
- <html>
- <head>
- <title>Welcome</title>
- </head>
- <h1>登录</h1>
- <form action="" method="post">
- 用户名:<input type="text" name="username"/><br/>
- 密 码:<input type="password" name="pwd"/></br>
- <input type="submit" value="登录"/> <input type="reset" value="重新填写"/></br>
- <input type="checkbox" name="v1">西瓜</br>
- <input type="checkbox" name="v1">苹果</br>
- <input type="radio" name="sex"/>男</br>
- <input type="radio" name="sex"/>女</br>
- <!--隐藏的用处是课提交数据,同时不影响界面-->
- <input type="hidden" value="123" name="sal"/>
- 选择你的出生地:
- <select name="bir">
- <option value="">--请选择--</option>
- <option value="bj">北京</option>
- <option value="bj">上海</option>
- <option value="cq">重庆</option>
- </select>
- </br>
- 请留言</br>
- <textarea cols="30" rows="10"></textarea></br>
- 选择要上传的文件</br>
- 请选择文件:<input type="file" name="myfile"/></br>
- </select>
- </form>
- </body>
- </html>