HTML学习笔记

HTML:超文本标记语言,是用来描述网页的一种语言。是一套标记标签。
标签是由 尖括号 包围的关键词
标签通常是 成对出现的
Web浏览器的作用是读取HTML文档,并以网页的形式显示。

乱码:HTML4.0 :<meta http-equiv="content-type" content="text/html;charset=utf-8">
HTML5.0:<meta charset="utf-8">

meta:元数据

相对路径:相对当前文件的路径
绝对路径:网络资源路径和全路径

<meta>:元数据
引入的元素都放在<head>中
设置颜色用:1、颜色所对应的英文单词;2、RGB值;

<a>超链接</a> 行级标签

超链接标签:<a href="链接地址" target="打开方式(当前页面还是新页面)"></a>
定义网页锚点
<a name="four">第四章</a>
链接当前网页锚点
<a href="#four">第四章</a>
链接目标网页的锚点
<a href="目标网址#four"></a>

表格标签:
定义:<table></table>

border="1"表格边框为1像素
align="center"表格相对浏览器页面位置center/left/right
width="50%" 表格宽度。50%表示占页面比例
定义表格高度:style="height: 500px"
rules="":规定内侧边框的哪个部分是可见的。

<tr></tr>定义表格中的行
<td></td>定义表格中的列

rowspan="3":合并3行
colspan=:3":合并3列


表单标签
<form action=""></from>
method="get":默认的提交方式,会显示用户名和密码,不安全
method="post":安全的提交方式,不会显示用户信息


文本框: <input type="text" value="请输入用户名" maxlength="5" />
密码框:<input type="password" maxlength="6"/>
单选框:<input type="radio" name="sex" checked="checked"/>男<input type="radio" name="sex"/>女
提交表单: <input type="submit" value="注册"/>
多选框: <input type="checkbox"/>吃饭 <input type="checkbox"/>睡觉
头像选择: <input type="file" />
设置图片提交: <input type="image" src="myimg/1.jpg"/>
功能键:<input type="reset" value="清空"/><input type="button" value="按钮"/>
下拉框: <select>
<option>--请选择--</option>
<option>四川</option>
<option>北京</option>
<option>云南</option>
</select>
文本域:
<textarea rows="3" cols="" >
xxxxx
</textarea>

只读:readonly="readonly"
不可用(灰色):disbale="disbale"
最大长度:maxlength="5";
默认:checked="checked"


HTML5新特性:
添加邮箱:<input type="email"/>

元素分组:
<fieldset>
<legend>必填选项</legend>
<table>
<tr>
<tb>姓名:</tb>
<td><input type="text"/></td>
</tr>
</table>
</fieldset>

<!--范围标签--突出表现所包含内容--->
价格:<span style="color: red;font-size: 25px">100</span>元

<!--Lable标签-->
<label style="color: green" for="userName">姓名:</label><input type="text" id="userName"/>
lable标签可以使点击 姓名 时能在文本框内获得光标

原文地址:https://www.cnblogs.com/zzyytt/p/6006383.html