» 2010-7-1 9:46:14 已被归档于 Html/Css
另存在http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd打开后会发现里面的代码全是HTML的规则.
看了一点.很有意思
第一:HTML标签的属性分类
分为四类:
从上面可以看出分为四类:
关于核心属性
一般的标签都有这个属性(包括id,class,style,title)
国际化属性
这个对页面语言编码有影响
UI事件属性
从DTD后面的发现.link标签也可以有事件属性.不过.我试了.好像没法触发.= =!!
焦点属性
focus,blur,tab键,Alt+键
第二类:HTML标签的嵌套
DTD里原代码如下:
主要的一部分
上面这些只是分类,inline元素和block元素.关于标签的嵌套有三种
具体可以参考下图.

//先写这么多.看这个DTD能学到不少东西.以后有新发现,再写^^'
看了一点.很有意思
第一:HTML标签的属性分类
分为四类:
<!--=================== Generic Attributes ===============================-->
<!-- core attributes common to most elements
id document-wide unique id
class space separated list of classes
style associated style info
title advisory title/amplification
-->
<!ENTITY % coreattrs
"id ID #IMPLIED
class CDATA #IMPLIED
style %StyleSheet; #IMPLIED
title %Text; #IMPLIED"
>
<!-- internationalization attributes
lang language code (backwards compatible)
xml:lang language code (as per XML 1.0 spec)
dir direction for weak/neutral text
-->
<!ENTITY % i18n
"lang %LanguageCode; #IMPLIED
xml:lang %LanguageCode; #IMPLIED
dir (ltr|rtl) #IMPLIED"
>
<!-- attributes for common UI events
onclick a pointer button was clicked
ondblclick a pointer button was double clicked
onmousedown a pointer button was pressed down
onmouseup a pointer button was released
onmousemove a pointer was moved onto the element
onmouseout a pointer was moved away from the element
onkeypress a key was pressed and released
onkeydown a key was pressed down
onkeyup a key was released
-->
<!ENTITY % events
"onclick %Script; #IMPLIED
ondblclick %Script; #IMPLIED
onmousedown %Script; #IMPLIED
onmouseup %Script; #IMPLIED
onmouseover %Script; #IMPLIED
onmousemove %Script; #IMPLIED
onmouseout %Script; #IMPLIED
onkeypress %Script; #IMPLIED
onkeydown %Script; #IMPLIED
onkeyup %Script; #IMPLIED"
>
<!-- attributes for elements that can get the focus
accesskey accessibility key character
tabindex position in tabbing order
onfocus the element got the focus
onblur the element lost the focus
-->
<!ENTITY % focus
"accesskey %Character; #IMPLIED
tabindex %Number; #IMPLIED
onfocus %Script; #IMPLIED
onblur %Script; #IMPLIED"
>
从上面可以看出分为四类:
1.核心属性(coreattrs);
2.国际化属性(internationalization attributes);
3.UI事件属性(attributes for common UI events);
4.焦点属性(attributes for elements that can get the focus)
关于核心属性
一般的标签都有这个属性(包括id,class,style,title)
国际化属性
这个对页面语言编码有影响
UI事件属性
从DTD后面的发现.link标签也可以有事件属性.不过.我试了.好像没法触发.= =!!
焦点属性
focus,blur,tab键,Alt+键
第二类:HTML标签的嵌套
DTD里原代码如下:
主要的一部分
<!-- text alignment for p, div, h1-h6. The default is
align="left" for ltr headings, "right" for rtl -->
<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
<!--=================== Text Elements ====================================-->
<!ENTITY % special.extra
"object | applet | img | map | iframe">
<!ENTITY % special.basic
"br | span | bdo">
<!ENTITY % special
"%special.basic; | %special.extra;">
<!ENTITY % fontstyle.extra "big | small | font | basefont">
<!ENTITY % fontstyle.basic "tt | i | b | u | s | strike ">
<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
<!ENTITY % phrase.extra "sub | sup">
<!ENTITY % phrase.basic "em | strong | dfn | code | q |samp | kbd | var | cite | abbr | acronym">
<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
<!ENTITY % inline.forms "input | select | textarea | label | button">
<!-- these can occur at block or inline level -->
<!ENTITY % misc.inline "ins | del | script">
<!-- these can only occur at block level -->
<!ENTITY % misc "noscript | %misc.inline;">
<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
<!-- %Inline; covers inline or "text-level" elements -->
<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
<!--================== Block level elements ==============================-->
<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
<!ENTITY % lists "ul | ol | dl | menu | dir">
<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
<!ENTITY % block
"p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
<!-- %Flow; mixes block and inline and is used for list items etc. -->
<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
<!--================== Content models for exclusions =====================-->
<!-- a elements use %Inline; excluding a -->
<!ENTITY % a.content
"(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
<!-- pre uses %Inline excluding img, object, applet, big, small,
font, or basefont -->
<!ENTITY % pre.content
"(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
%inline.forms; | %misc.inline;)*">
<!-- form uses %Flow; excluding form -->
<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
<!ENTITY % button.content
"(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
table | br | span | bdo | object | applet | img | map |
%fontstyle; | %phrase; | %misc;)*">
上面这些只是分类,inline元素和block元素.关于标签的嵌套有三种
1.单一的inline元素;
2.单一的block元素;
3.inline元素和block元素,DTD里叫Flow(混合);
具体可以参考下图.

//先写这么多.看这个DTD能学到不少东西.以后有新发现,再写^^'