您的位置:首页 > Web前端 > HTML

XHTML

2014-04-14 10:57 113 查看
XHTML is HTML written as XML.

XHTML stands for EXtensible HyperText Markup Language 可扩展的HTML
XHTML is almost identical to HTML,
stricter than HTML
XHTML is HTML defined as an XML application
XHTML is supported by all major browsers

Why XHTML?

Today's market consists of different browser technologies. Some browsers run on computers, and some browsers run on mobile phones or other small devices. 

现在市场上有许多不同的浏览器技术,一些运行在电脑上,一些则是在移动电话或小型设备上。

Smaller devices often lack the resources or power to interpret a "bad" markup language.

小型设备往往缺乏资源和能力去翻译一个“不好”的标记语言。

Therefore - by combining the strengths of HTML and XML, XHTML was developed. 

XHTML is HTML redesigned as XML(可扩展标记语言,designed
to transport and store data).

The Most Important Differences from HTML:

Document Structure 文本结构

XHTML DOCTYPE is mandatory 强制性的
The xmlns attribute in <html>, must specify the xml namespace for the document 必须指明文件的XML命名空间

<html xmlns="http://www.w3.org/1999/xhtml">


<html>, <head>, <title>, and <body> is mandatory(必须出现)

XHTML Elements 元素

XHTML elements must be properly nested 元素必须正确地嵌套,error example:<p><a></p></a>
XHTML elements must always be closed,
一般元素
必须闭合 <p>...</p> 
[b]空元素
也必须闭合 <br/> <img
/>
[/b]

XHTML elements must be in lower case 小写

XHTML Attributes 属性

Attribute names must be in lower case 小写
Attribute values must be quoted 被双引号扩住
Attribute minimization is forbidden 禁止简写
关于 Attribute minimization 错误的例子:
<input checked>
<input readonly>
<input disabled>
<option selected>


正确写法:
<input checked="checked">
<input readonly="readonly">
<input disabled="disabled">
<option selected="selected">
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  XHTML