HTML常用标签
-----Hyper Text Markup Language超文本标记语言
注释
<!--..注释的内容..-->
空格
设置页面字符集
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
刷新跳转界面
<meta http-equiv="refresh" content="1">
<meta http-equiv="refresh" content="3;url=http://www.baidu.com">
<meta http-equiv="refresh" content="3;url=2.html">
设置背景
<body bgcolor="#rrggbb">
<body background="图片路径">
超链接
<a></a>
<a href="url#锚名称">文本/图片/按钮...</a> #标识当前页面
<a name="锚名称">
可链接到其它页面也可链接到当前页面锚名称所在处
target:属性
Frame name 框架中的某个frame
_blank 新窗口
_self 本窗口
_parent 父窗口(本窗口的上一级窗口)
_top 浏览器窗口
分割线
<hr color="red" width="像素/百分比" align="left|center|right" size="高度">
对齐方式
align="left|center|right" 左/中/右
标题
从<h1>到<h6>
<h1>标题1.。。。</h1>
.....................
<h6>标题6。。。</h6>
文本字体
<font face="宋体" size="7" color="red">文字</font>
文字跑马灯<marquee></marquee>
loop="循环次数,-1为无限"
direction="left|right|up|down" 方向
scrollamount="速度"
height="高度"
段落
<p>...</p>
层
<div>...</div>
无序列表
<ul>
<li>...</li>
<li>...</li>
</ul>
有序列表
<ol>
<li>...</li>
<li>...</li>
</ol>
原样输出
<pre>...</pre>
代码中的空格换行位置都会保留
图片
<img> </img>
src="图片路径";
alt="图片加载失败后要显示的文字";
表格
<table><tr><td>
表头可将<td>换成<th>
width 宽
height 高
bgcolor="black" 表格的背景色
cellspacing="1" 单元格与单元格空间
cellpadding="1" 表格边框与单元格补白的距离
colspan 列合并单元格
rowspan 行合并单元格
例子:
<table width="400" height="200" bgcolor="black" cellspacing="1" cellpadding="1">
<tr bgcolor="white">
<td colspan="3"></td>
</tr>
<tr bgcolor="white">
<td rowspan="2"></td>
<td></td>
<td></td>
</tr>
</table>
表单
<form></form>
method
action 指定要提交的服务器
表单中的标签
文本框
<input type="text" name="" value="" maxlength="最大字符长度" size="文本框宽度">
密码框
<input type="password">
单选框
<input type="radio" name="" checked> 一组单选框 name需相同,checked表示被选中
复选框
<input type="checkbox" selected> selected表示被选中
下拉菜单
<select name="" size="" multiple selected> Multiple 表示可以多选,Selected表示被选中
<option value=""></option>
<option value=""></option>
</select>
多行多列文本框
<textarea rows="" cols="" wrap="">…</textarea>
Rows: 行数
Cols: 列数
Wrap:
-Off : 不换行
-Soft: 自动换行,并且如果行末有英文单词,会将整个单词移到下一行
-Hard: 自动换行,但会截断行末的单词
按钮
button:普通按钮(没有事件,需要结合JavaScript实现功能)
submit:提交按钮(将数据提交到服务器)
reset:重置按钮
img:图片按钮(有提交的功能)
隐藏域
hidden:隐藏域(向服务器传递数据)
文件域
file:文件域(可选择文件)
框架
rows="10%,*" 几行
cols="10%,*" 几列
格式:
<frameset rows="">
<frame src=""></frame>
<frameset cols="">
<frame src=""></frame>
<frame src=""></frame>
</frameset>
</frameset>