HTML5与HTML4的区别-----文档结构
HTML5在结构和语法上做了大量的简化。当然,也提供了语义化的标签
结构上区别:
1.简化了文档声明语句 HTML5仅规定了一种: <!DOCTYPE html>
2.简化了设置字符编码 <meta charset="UTF-8">
charset 属性是 HTML5 中的新属性,且替换了:<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
语法区别:
1.省略了一些标签:
全部省略: html body head tbody
在实际编码中,不建议省略像 html body head元素。一是习惯上无法接受;二是看着别扭
省略结束标签:
li p ( dl dt) (tr th td thead tbody tfoot table表单) option
可以不闭合的空标签:
br img hr input link meta
2.具有boolean值属性
checked selected disabled
HTML5中 <input type="checkbox" checked > 或者 <input type="checkbox" checked="" /> 都是ok的
HTML4 <input type="checkbox" checked="true" /> <input type="checkbox" checked="false" /> 后面的赋值不可以省略
3.省略引号
<input type = radio > 语法上是ok的, 在不考虑兼容的情况下。建议带上引号
4.忽略大小写
在HTML5中是忽略大小写的 <INPUT type="Radio"> 引擎是可以正确编译的
================完结======================
(补充上一篇的, 图文混排 HTML5新增了 figure 元素。 功能类似于 dl结构
figure: 标签规定独立的流内容(图像、图表、照片、代码等等)
元素的内容应该与主内容相关,同时元素的位置相对于主内容是独立的。如果被删除,则不应对文档流产生影响。
<figure>
<img src="img_pulpit.jpg" tppabs="http://w3schools.com/tags/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
</figure>
figcaption: 为figure元素定义标题
放在figure元素的第一个或最后一个子元素的位置
<figure>
<img src="img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
<figcaption>Fig.1 - A view of the pulpit rock in Norway.</figcaption>
</figure>
最新文章
- 冲刺一 (Day 2)
- three.js 显示一条线
- C++ Primer : 第十三章 : 拷贝控制示例
- Scene视图辅助线绘制
- 一次tomcat服务器被入侵解决办法
- goldengate 12c 针对oracle 12c配置的主要变化
- iOS程序崩溃*** Terminating app due to uncaught exception &#39;CALayerInvalidGeometry&#39;, reason: &#39;CALayer position contains NaN: [37.5 nan]&#39;
- Paint House II 解答
- Assertion failure in -[UIView layoutSublayersOfLayer:]
- IT团队管理
- Digilent Xilinx USB Jtag cable
- C# int数组转string字符串
- MT【280】最小值函数
- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column &#39;information_schema.PROFILING.SEQ&#39; which is not functionally dependent on columns in GROUP BY clause; this
- 501. Find Mode in Binary Search Tree【LeetCode by java】
- 4种PHP回调函数风格
- 【转】Ultra simple ISO-7816 Interface
- python opencv3 基于ORB的特征检测和 BF暴力匹配 knn匹配 flann匹配
- ECharts饼图制作分析
- Redis2.8.7配置文件说明