您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

干净的XHTML语法_HTML/Xhtml_网页制作

2024/4/27 14:00:48发布4次查看
writing xhtml demands a clean html syntax.
写xhtml要求使用干净的html语法
--------------------------------------------------------------------------------
some more xhtml syntax rules:
更多xhtml语法规则:
attribute names must be in lower case
属性名称必须为小写
attribute values must be quoted
属性值使用双引号
attribute minimization is forbidden
属性简写是不允许的
the id attribute replaces the name attribute
用id属性来替代name属性
the xhtml dtd defines mandatory elements
xhtml dtd定义强制元素
--------------------------------------------------------------------------------
attribute names must be in lower case
属性名称必须为小写
this is wrong:
这是错误的:
this is correct:
这是正确的:
--------------------------------------------------------------------------------
attribute values must be quoted
属性值必须带上双引号
this is wrong:
这是错误的:
this is correct:
这是正确的:
--------------------------------------------------------------------------------
attribute minimization is forbidden
不允许属性简写
this is wrong:
这是错误的:
this is correct:
正确的是这样:
here is a list of the minimized attributes in html and how they should be written in xhtml:
这是在html中简写的属性和其在xhtml中应该怎样书写的列表:
html xhtml
compact compact=compact
checked checked=checked
declare declare=declare
readonly readonly=readonly
disabled disabled=disabled
selected selected=selected
defer defer=defer
ismap ismap=ismap
nohref nohref=nohref
noshade noshade=noshade
nowrap nowrap=nowrap
multiple multiple=multiple
noresize noresize=noresize
--------------------------------------------------------------------------------
the id attribute replaces the name attribute
id属性替换name属性
html 4.01 defines a name attribute for the elements a, applet, frame, iframe, img, and map. in xhtml the name attribute is deprecated. use id instead.
对于a, applet, frame, iframe, img和map,html 4.01中定义了一个name属性,在xhtml中是不赞成这样做的,使用id来代替。
this is wrong:
这是错误的:
this is correct:
这是正确的:
note: to interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this:
注意:为了版本比较低的浏览器,你应该同时使用name和id属性,并使它们两个的值相同的,像这样:
important compatibility note:
兼容性注意点:
to make your xhtml compatible with today''s browsers, you should add an extra space before the / symbol.
让你的xhtml兼容当前的浏览器你应该在/标记前添加空格
--------------------------------------------------------------------------------
the lang attribute
lang 属性
the lang attribute applies to almost every xhtml element. it specifies the language of the content within an element.
lang属性可以应用于几乎所有的xhtml元素。它指定了元素中内容的语言
if you use the lang attribute in an element, you must add the xml:lang attribute, like this:
如果你像在一个元素中应用lang属性,你必须加上xml:lang属性,像这样:
heia norge!
--------------------------------------------------------------------------------
mandatory xhtml elements
强制xhtml元素
all xhtml documents must have a doctype declaration. the html, head and body elements must be present, and the title must be present inside the head element.
所有的xhtml文档都必须有一个doctype声名。html、head和body元素必须出现,并且title必须在head元素里
this is a minimum xhtml document template:
这是一个极小的xhtml文档模板
oes here>
title goes here
body text goes here
note: the doctype declaration is not a part of the xhtml document itself. it is not an xhtml element, and it should not have a closing tag.
注意:doctype声明并不是xhtml文档自身的一部分。它也不是xhtml元素,它不该有关闭标签。
note: the xmlns attribute inside the tag is required in xhtml. however, the validator on w3.org does not complain when this attribute is missing in an xhtml document. this is because xmlns=http://www.w3.org/1999/xhtml is a fixed value and will be added to the tag even if you do not include it.
注意:xhtml文档要求xmlns属性出现在html标签中。然而,w3.org的校验器不会由于这个属性没有出现在你的xhtml文档中而报告错误。这是因为xmlns=http://www.w3.org/1999/xhtml是一个固定的值,即使你的文档里没有包含它,它也会自动加上的。
you will learn more about the xhtml document type definition in the next chapter
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录