表格和表单

表格和表单
表格
表格:表格由table进行定义,如
table border=“1” cellspacing=“0” cellpadding=“0” width=“500px” height=“300px”
其中border定义边框的密集度,为0则不显示边框,cellspacing单元格边框距离,cellpadding是单元格内容距离,设置为0时表格显示细表格,width和height设置表格的宽和高。
tr代表行,table中有多少个表示表格有多少行;
td代表列,在tr中有多少td则代表有多少列;
th也存在tr中表示表格内的表头,单元格内容加粗且居中;
行合并rowspan,体现在不同tr中的同一td中,且合并的突然中对应的td需要删除;
列合并colspan,列合并,在同一tr中,切合并的td需要删除;
align表格中的对齐属性,在

里则是整个单元格相对周围内容的位置,在tr中则是这一行的对齐状态,在td中则是这一列的对齐状态;

表单:form method=“post” action=“a.html”>
</form,action="a.html指跳转的位置(前后少<>)
文本类:
文本框 input type = “text” >生成一个可填写且显示输入内容的文本框;
密码框 input type = “password” >生成一个可填写但不显示输入内容的文本框;
隐藏域(页面不显示) input type = “hidden” >,页面不显示;
文本域 textarea></textarea(少<>),可通过cols=“50” rows=“10”>设置生成的文本区域的大小;
按钮类:
普通按钮 input type = “button” value = “确定” >,生成确认按钮
提交按钮 input type = “submit” value = “提交” >生成提交按钮,可进行指定页面跳转;
重置按钮 input type = “reset” value = “重置” >,生成取消按钮,取消输入内容;
图片按钮 input type = “image” src=“xingkong.jpg” width=“100px” height=“40px”>,可通过点击图片进行跳转;
选择类:
单选按钮:input type = "radio"name=“sex” checked>男input type=“radio” name=“sex”>女,生成男女单选按钮,且默认值为男
复选按钮:input type = "checkbox"checked>唱歌input type=“checkbox”>跳舞input type=“checkbox”>游泳,生成多选按钮,checked是默认选项
下拉列表:
select name=“country”>
option value=“none”>–选择国家–
option value=“usa”>美国
英国
option value=“cn” selected=“selected”>中国
/select>,selected="selected"将中国设置为默认值

文件:input type = “file” />,可选择文件插入
H5新的输入类型:
邮箱:input type=“email” />,邮箱输入必须有@,且@后有内容;
网址:input type=“url” />,必须是完整的网址,http://
搜索:input type=“search” />
数值:input type=“number” min=“3” max=“20” step=“1” value=“3”/>,3是初始大小,每次翻动变化为1
数值选择器:input type=“range” min=“2” max=“15” step=“1” value=“3”/>,生成滑动选择大小,不显示数字;
日期:input type=“date”/>,生成日期选择器;
时间: input type=“time”/>,生成时间选择器;
input type=“text” required=“required”>生成的文本框为必须进行的项目;
input type=“text” placeholder=“请输入姓名”>在文本框中有默认提示;