目录
头部标签(head title base link meta sript style)
其他表单标签(select option textarea(多行文本框)datalist(下拉选项) )
HTML5
基本结构
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
</html>
HTML5基本标签
头部标签(head title base link meta sript style)
<link rel="stylesheet" type="text/css" href="mystyle.css">
<base href="http://baidu.com/images" />
<base target="_blank" /> //<base>标签为页面上的所有链接规定默认地址或默认目标
如果没有指定目录,那么直接在此文档下面搜索文件。
<style type="text/css">
body {background-color:yellow}
p {color:blue}
</style>
<script type="text/javascript">
alert("这是运行一个脚本");
</script>
标题标签(h1-6)
<h1>这是一级标题</h1>
<h2>这是二级标题</h2>
<h3>这是三级标题</h3>
<h4>这是四级标题</h4>
<h5>这是五级标题</h5>
<h6>这是六级标题</h6>
输入框(input)
类型有 url, email, date, time, datetime, month, week, number, range, search, tel, color
<input type="number" name="number" max="100" min="20" value="50" />
段落标签(p pre)
<p>这是一个段落</p>
链接标签(a)
<a href="https://www.baidu.com">打开百度,你就知道!</a>
图像标签(img)
属性可以有width height
alt | 图片显示不出来时的提示文字 |
title | 鼠标移到图片上的提示文字 |
<img src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png" alt="百度LOGO">
表格标签(table tr td th)
合并行 rowspan = ”2“
合并列 colspan = “2”
<table border="1px" cellpadding="0px" cellspacing="0px">
<tr>
<th>表头一</th>
<th>表头二</th>
<th>表头三</th>
<th>表头四</th>
</tr>
<tr>
<td>单元格一</td>
<td>单元格二</td>
<td>单元格三</td>
<td>单元格四</td>
</tr>
</table>
列表标签(ul li ol li)
无序标签
<ul>
<li>列表项</li>
<li>列表项</li>
<li>列表项</li>
<li>列表项</li>
</ul>
有序标签
<ol>
<li>列表项</li>
<li>列表项</li>
<li>列表项</li>
<li>列表项</li>
</ol>
自定义列表
<dl>
<dt>+</dt><dd>列表项</dd>
<dt>+</dt><dd>列表项</dd>
<dt>+</dt><dd>列表项</dd>
</dl>
分组标签(div和span)
表单标签(form、label)
from input lable演示
<form action="" method="get">
<p>
<label for="username">账户:</label>
<input type="text" name="username" id="username">
</p>
<p>
<label for="password">密码:</label>
<input type="password" name="password" id="password">
</p>
<p><input type="submit"></p>
</form>
其他表单标签(select option textarea(多行文本框)datalist(下拉选项) )
textarea演示
<textarea rows="行数" cols="列数">多行文本框内容</textarea>
<form action="" method="post">
<textarea name="mycontext" cols="30" rows="10"></textarea>
<input type="submit">
</form>
fieldset、legend、select、optgroup、option演示
<form action="" method="post">
<fieldset>
<legend>请选择你的爱好:</legend>
<select name="myhobby" id="myhobby">
<optgroup label="运动">
<option value="篮球">篮球</option>
<option value="足球">足球</option>
</optgroup>
<optgroup label="电子">
<option value="看电影">看电影</option>
<option value="看电视">看电视</option>
</optgroup>
</select>
</fieldset>
</form>
datalist演示
<form action="" method="post">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
单选框演示
<form action="" method="post">
<input type="radio" name="sex" id="male" value="male" checked>
<label for="male">Male</label>
<input type="radio" name="sex" id="female" value="female">
<label for="female">female</label>
</form>
复选框演示
<form action="" method="post">
<input type="checkbox" name="vehicle" id="bike" value="bike">
<label for="bike">I have a bike</label>
<input type="checkbox" name="vehicle" id="car" value="car">
<label for="car">I have a car</label>
</form>
框架标签(iframe)
<iframe src="https://www.baidu.com" frameborder="0" width="500px" height="500px"></iframe>
音频标签(audio)
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
您的浏览器不支持 Audio 标签。
</audio>
视频标签(video)
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
您的浏览器不支持 Video 标签。
</video>
其它标签
水平线:<hr>
换行:<br>
<b>粗体文本</b>
<code>计算机代码</code>
<em>强调文本</em>
<i>斜体文本</i>
<kbd>键盘输入</kbd>
<pre>预格式化文本</pre>
<small>更小的文本</small>
<strong>重要的文本</strong>
<abbr>缩写词或者首字母缩略词</abbr>
<address>联系信息</address>
<bdo>文字方向</bdo>
<blockquote>从另一个源引用的部分</blockquote>
<cite>工作的名称</cite>
<del>删除的文本</del>
<ins>插入的文本</ins>
<sub>下标文本</sub>
<sup>上标文本</sup>
HTML5属性(class id )
右键菜单(menu menuitem)
进度条(progress)
<progress class="process" value='70' max='100'></progress>
换行符(<br/>)
格式要求输入(性别 颜色 日期)
<form action="index.html" method="post">
<table >
<tr height="40dp"><td>名字:<input type="text" required="required" /></td></tr>
<tr height="40dp"><td>姓氏:<input type="text" required="required" /></td></tr>
<tr height="40dp"><td>登录名:<input type="text" required="required" pattern="[A-z]{3}[0-9]{3}" /></td></tr>
<tr height="40dp"><td>密码:<input type="password" required="required"/></td></tr>
<tr height="40dp"><td>性别:<input type="radio" value="男" name="sex" checked="checked"/>男 <input type="radio" value="女" name="sex"/>女</td></tr>
<tr height="40dp"><td>email:<input type="email"/></td></tr>
<tr height="40dp"><td>年龄:<input type="number" max="40" min="10"/></td></tr>
<tr height="40dp"><td>你喜爱的颜色:<input type="color"/></td></tr>
<tr height="40dp"><td>你的个人主页:<input type="url"/></td></tr>
<tr height="40dp">
<td>
友情链接:<input type="text" list="wcx"/>
<datalist id="editor">
<option value="http://www.baidu.com">百度</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.sina.com.cn">新浪</option>
</datalist>
</td>
</tr>
<tr height="40dp"><td>出生年月日:<input type="date"/></td></tr>
<tr height="40dp"><td>专业:<input type="text" placeholder="请输入您的专业方向"/></td></tr>
<tr height="40dp">
<td>
<input type="submit" value="重 填"/>
<input type="submit" value="提交到A.html" formaction="A.html"/>
<input type="submit" value="提交到B.html" formaction="B.html"/>
</td>
</tr>
</table><br/>
</form>