返回爱好者网站首页
 
商城 博墅 论坛
首 页 | 学 院 | 数 码 | 硬 件 | 装机DIY | 台式机 | 办 公 | 数字家电 | 视频教程 | Flash小游戏 | 桌面壁纸 | 精彩专题 | 活动
  数码数码相机 手机 MP3/MP4 笔记本 GPS 硬件CPU 主板 存储 音频 显示器 显卡 投影机 机箱/电源 外设 术语 学院资讯 系统 软件 安全 网络 办公 设计 程序 问答
装机DIY家用 网吧 办公 娱乐 2000元 4000元 6000元 8000元 DIY技巧 答疑 台式机入门 家用 办公 娱乐 购买技巧 答疑 办公打印机 多功能一体机
学院首页 | 新闻资讯 | 操作系统 | 软件应用 | 创意设计 | 程序开发 | 办公技巧 | 网络应用 | 个人安全 | 素材推荐 | 故障问答
CFan新视界 | 软件专区 | Vista专区 | XP专区 | 站长专区 | 专栏作者 | 精彩专题
· PhotoShop CS · Dreamweaver · Flash · ASP · Excel · Word · CorelDRAW · 3D Max · PhotoShop 7.0 · 常用软件
当前位置: 首页 学院 创意设计 网页设计

干净的XHTML语法

1000元免费加油卡,点击就送 很酷很个性 我的QQ空间留言最最炫  

2008-08-01 作者: 来源:网页教学网
·抠图——孔雀美女
·胆小者勿进
·教你打造蝶蝎美人
·正在消失的美女
·亲手给MM加幅眼镜
·合成绝美的天上人间
·古堡中的梦幻女孩
·合成密林深处的公主
·墙壁上的剥落女孩
·森林里的蝴蝶公主
   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:
这是错误的:

<table WIDTH="100%">This is correct:
这是正确的:

<table width="100%">

--------------------------------------------------------------------------------

Attribute Values Must Be Quoted
属性值必须带上双引号
This is wrong:
这是错误的:

<table width=100%>This is correct:
这是正确的:

<table width="100%">

--------------------------------------------------------------------------------

Attribute Minimization Is Forbidden
不允许属性简写
This is wrong:
这是错误的:

<input checked>
<input readonly>
<input disabled>
<option selected>
<frame noresize>This is correct:
正确的是这样:

<input checked="checked" />
<input readonly="readonly" />
<input disabled="disabled" />
<option selected="selected" />
<frame noresize="noresize" />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:
这是错误的:

<img src="picture.gif" name="picture1" />This is correct:
这是正确的:

<img src="picture.gif" id="picture1" />Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this:
注意:为了版本比较低的浏览器,你应该同时使用name和id属性,并使它们两个的值相同的,像这样:

<img src="picture.gif" id="picture1" name="picture1" />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属性,像这样:  

<div lang="no" xml:lang="no">Heia Norge!</div>

--------------------------------------------------------------------------------

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文档模板

<!DOCTYPE Doctype goes here>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title goes here</title>
</head><body>
Body text goes here
</body></html>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 <html> 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 <html> 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
制作网页七招实用技巧
· DW轻松打造Flash像册
· 用DW打造自己的Blog(3
· DW打造在线音乐网站
· DW网页滚动字幕的制作
· 用DW打造企业新闻系统
制作网页的十大诀窍!
· js表单验证控制代码大
· 用DW打造自己的Blog(6
· 用DW打造自己的Blog(7
· Dreamweaver制作网页
· 用DW打造动态网站
热点推荐



· 用完电脑一定要洗把脸
· 电脑一族必喝的健康饮料
· 炎热夏天 多吃三类蔬菜
· 卖什么都有,卖脸你见过吗
· 无聊老师的17则爆笑语录
· photoshop快捷键大全
· 《功夫熊猫》经典台词!
· 近距离接触中国击剑队
· 分享网络推广的八种方法
站外资源推荐
无标题文档
绝色空姐汇聚的航线
评论
评论排行
Google排名—搜索引擎登记技巧
如何在百度与google上做免费广告
如何提高网站流量和PV?
50条秘技教你怎么推广新网站
宣传网站的一些简单办法
宣传网站提升网站流量之网摘速成法
快速提高网站流量的办法(1周2000IP变2WIP)
妙招宣传网站让你的网站人气冲天
菜鸟如何快速推广新网站让百度快速收录
用DreamWeaver打造留言板

笔名

匿名发表

验证码:

查看评论
* 评论只代表网友个人观点,与电脑爱好者网站无关,不代表电脑爱好者网站也同意此观点。
 
热点专题
 
· 用DW打造自己的Blog
· 09年广州车展
· 狂人马云与阿里巴巴
· 开个网店做老板
· Web服务器架设攻略
· 三大浏览器应用技巧
· 建站四步曲
· 月入上万的程序员们
· 如何推广新网站及赚钱
· 手机铃声制作攻略
· 系统安装步步通
· 新手学电脑
热点文章
 
傲游使用技巧 地址栏图标的妙用 一个校园网站的成长历程
让你操作Windows于弹指之间 利用Google地图驾车环游世界
看看在线操作系统什么样

歌曲下载快到飚 搜狗音乐盒大体验

QQ专区
 
站长专区
 
·做ADSENSE的英文站月薪几千
·再谈:什么样的网站能赚钱
·江礼坤:手把手教你策划网站
·教育类网站如何赚钱
·十招让内容页流量翻番
· 个人网站建设到底怎样赚钱
·月赚三四千元 网上开店秘笈
·站长如何有效推广网站
·一个校园网站的成长历程
·如何防止自己的站被人采集
论坛博墅
 
·玩转Vista加速与优化
·十招学会软件的破解
·Ubuntu 安装的一小点心得
·手动去除迅雷广告
·揭秘黑客真身
·QQ秘籍让你成为QQ高手
·硬件检测软件逐个看
·劲舞团不能倒闭的八大理由
·2月5日 单机游戏下载合集
·国内网页设计网站大全
无标题文档
快速链接:站长专区 Vista专区 XP专区 风行软件专区 电脑必备软件 免费在线小游戏 免费在线视频教程 学院专题 数码专题 硬件专题

爱好者网站版权所有 未经授权禁止复制或建立镜像
Copyright(C) cfan.com.cn,All rights reserved
京ICP证010182号