内容 |
说起W3C标准头部声明、DTD 我居然第一时间想到的就是 DHTML 头部声明这些个东西、前端js写了块一年了这些个标准化的东西确所知甚少、下午闲来无事稍微整理了下分享出来不完整的地方希望大家能补充一下。 DTD 是一套关于标记符的语法规则。它是XML1.0版规格得一部分,是html文件的验证机制,属于html文件组成的一部分。 DTD:三种文档类型:S(Strict)、T(Transitional)、F(Frameset)。 Strict:如果您需要干净的标记,免于表现层的混乱,请使用此类型。请与层叠样式表(CSS)配合使用 Transitional:DTD 可包含 W3C 所期望移入样式表的呈现属性和元素。如果您的读者使用了不支持层叠样式表(CSS)的浏览器以至于您不得不使用 HTML 的呈现特性时使用 Frameset: DTD 应当被用于带有框架的文档。除 frameset 元素取代了 body 元素之外,Frameset DTD 等同于 Transitional DTD html5基本上没有XHTML 1.0 Transitional严格的要求,并且简化了很多东西可以直接使用 <!DOCTYPE HTML> HTML5 <!DOCTYPE HTML> —————————————————————————————— xhtml 1.1: <!doctype html public "-/w3c/dtd xhtml 1.1/en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> xhtml 1.1 plus mathml plus svg: <!doctype html public "-/w3c/dtd xhtml 1.1 plus mathml 2.0 plus svg 1.1/en" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> —————————————————————————————— html 4.01 strict: <!doctype html public "-/w3c/dtd html 4.01/en" "http://www.w3.org/tr/html4/strict.dtd"> html 4.01 transitional: <!doctype html public "-/w3c/dtd html 4.01 transitional/en" "http://www.w3.org/tr/html4/loose.dtd"> html 4.01 frameset: <!doctype html public "-/w3c/dtd html 4.01 frameset/en" "http://www.w3.org/tr/html4/frameset.dtd"> —————————————————————————————— xhtml 1.0 strict: <!doctype html public "-/w3c/dtd xhtml 1.0 strict/en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> xhtml 1.0 transitional: <!doctype html public "-/w3c/dtd xhtml 1.0 transitional/en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> xhtml 1.0 frameset: <!doctype html public "-/w3c/dtd xhtml 1.0 frameset/en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-frameset.dtd"> —————————————————————————————— html 3.2: <!doctype html public "-/w3c/dtd html 3.2 final/en"> —————————————————————————————— html 2(数字2代表版本号): <!doctype html public "-/ietf/dtd html 2.0/en"> 附上一张老版本标签对照DTD文档:
标签 |
描述 |
Dtd |
<!DOCTYPE> |
定义文档类型。 |
STF |
<html> |
定义 HTML 文档。 |
STF |
<body> |
定义文档的主体。 |
STF |
<h1> to <h6> |
定义 HTML 标题。 |
STF |
<p> |
定义段落。 |
STF |
<br> |
定义简单的折行。 |
STF |
<hr> |
定义水平线。 |
STF |
<!--...--> |
定义注释。 |
STF |
|
|
|
标签 |
描述 |
Dtd |
<b> |
定义粗体文本。 |
STF |
<font> |
不赞成使用。定义文本的字体、尺寸和颜色 |
TF |
<i> |
定义斜体文本。 |
STF |
<em> |
定义强调文本。 |
STF |
<big> |
定义大号文本。 |
STF |
<strong> |
定义语气更为强烈的强调文本。 |
STF |
<small> |
定义小号文本。 |
STF |
<sup> |
定义上标文本。 |
STF |
<sub> |
定义下标文本。 |
STF |
<bdo> |
定义文本的方向。 |
STF |
<u> |
不赞成使用。定义下划线文本。 |
TF |
|
|
|
标签 |
描述 |
Dtd |
<pre> |
定义预格式文本 |
STF |
<code> |
定义计算机代码文本。 |
STF |
<tt> |
定义打字机文本。 |
STF |
<kbd> |
定义键盘文本。 |
STF |
<var> |
定义文本的变量部分。 |
STF |
<dfn> |
定义定义项目。 |
STF |
<samp> |
定义计算机代码样本。 |
STF |
<xmp> |
不赞成使用。定义预格式文本。 |
|
|
|
|
标签 |
描述 |
Dtd |
<acronym> |
定义只取首字母的缩写。 |
STF |
<abbr> |
定义缩写。 |
STF |
<address> |
定义文档作者或拥有者的联系信息。 |
STF |
<blockquote> |
定义块引用。 |
STF |
<center> |
不赞成使用。定义居中文本。 |
TF |
<q> |
定义短的引用。 |
STF |
<cite> |
定义引用(citation)。 |
STF |
<ins> |
定义被插入文本。 |
STF |
<del> |
定义被删除文本。 |
STF |
<s> |
不赞成使用。定义加删除线的文本。 |
TF |
<strike> |
不赞成使用。定义加删除线的文本。 |
TF |
|
|
|
标签 |
描述 |
Dtd |
<a> |
定义锚。 |
STF |
<link> |
定义文档与外部资源的关系。 |
STF |
|
|
|
标签 |
描述 |
Dtd |
<frame> |
定义框架集的窗口或框架。 |
F |
<frameset> |
定义框架集。 |
F |
<noframes> |
定义针对不支持框架的用户的替代内容。 |
TF |
<iframe> |
定义内联框架。 |
TF |
|
|
|
标签 |
描述 |
Dtd |
<form> |
定义供用户输入的 HTML 表单。 |
STF |
<input> |
定义输入控件。 |
STF |
<textarea> |
定义多行的文本输入控件。 |
STF |
<button> |
定义按钮。 |
STF |
<select> |
定义选择列表(下拉列表)。 |
STF |
<optgroup> |
定义选择列表中相关选项的组合。 |
STF |
<option> |
定义选择列表中的选项。 |
STF |
<label> |
定义 input 元素的标注。 |
STF |
<fieldset> |
定义围绕表单中元素的边框。 |
STF |
<legend> |
定义 fieldset 元素的标题。 |
STF |
<isindex> |
不赞成使用。定义与文档相关的可搜索索引。 |
TF |
|
|
|
标签 |
描述 |
Dtd |
<ul> |
定义无序列表。 |
STF |
<ol> |
定义有序列表。 |
STF |
<li> |
定义列表的项目。 |
STF |
<dir> |
不赞成使用。定义目录列表。 |
TF |
<dl> |
定义定义列表。 |
STF |
<dt> |
定义定义列表中的项目。 |
STF |
<dd> |
定义定义列表中项目的描述。 |
STF |
<menu> |
不赞成使用。定义菜单列表。 |
TF |
|
|
|
标签 |
描述 |
Dtd |
<img> |
定义图像。 |
STF |
<map> |
定义图像映射。 |
STF |
<area> |
定义图像地图内部的区域。 |
STF |
|
|
|
标签 |
描述 |
Dtd |
<table> |
定义表格 |
STF |
<caption> |
定义表格标题。 |
STF |
<th> |
定义表格中的表头单元格。 |
STF |
<tr> |
定义表格中的行。 |
STF |
<td> |
定义表格中的单元。 |
STF |
<thead> |
定义表格中的表头内容。 |
STF |
<tbody> |
定义表格中的主体内容。 |
STF |
<tfoot> |
定义表格中的表注内容(脚注)。 |
STF |
<col> |
定义表格中一个或多个列的属性值。 |
STF |
<colgroup> |
定义表格中供格式化的列组。 |
STF |
|
|
|
标签 |
描述 |
Dtd |
<style> |
定义文档的样式信息。 |
STF |
<div> |
定义文档中的节。 |
STF |
<span> |
定义文档中的节。 |
STF |
|
|
|
标签 |
描述 |
Dtd |
<head> |
定义关于文档的信息。 |
STF |
<title> |
定义文档的标题。 |
STF |
<meta> |
定义关于 HTML 文档的元信息。 |
STF |
<base> |
定义页面中所有链接的默认地址或默认目标。 |
STF |
<basefont> |
不赞成使用。定义页面中文本的默认字体、颜色或尺寸。 |
TF |
|
|
|
标签 |
描述 |
Dtd |
<script> |
定义客户端脚本。 |
STF |
<noscript> |
定义针对不支持客户端脚本的用户的替代内容。 |
STF |
<applet> |
不赞成使用。定义嵌入的 applet。 |
TF |
<object> |
定义嵌入的对象。 |
STF |
<param> |
定义对象的参数。 |
STF | |