XHTML 使用手记 By Stabx

来源:互联网 发布:淘宝g家是什么牌子 编辑:程序博客网 时间:2024/04/29 03:15
/**/
标题: XHTML 使用手记 By Stabx

正文:

QUOTE:

XHTML 使用手记 By Stabx

CREATED BY STABX, AT 2006-6-2. 

xhtml notebook By shawl.qiu

---/-----------------------------------------------------------

1. script / 脚本
2. css / 样式表
3. uri
4. img 标签
5. 单属性值必须加上该属性值和其值
6. 附加

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


CODE:

QUOTE:

shawl.qiu<shawl.qiuATgmail.com>
绿色学院 | http://blog.csdn.net/btbtd/
2006-6-11

5. 单属性值须重写为 该属性值="该属性值"
checked == checked="checked"
selected == selected="selected"

4. img 标签 须加上描述
<img src="img.jpg" alt="description.." /> //XHTML 1.*
//XHTML 2.0 img 标签 须成对闭合, 如: <img src="" alt="">description...</img>

3.1 URL 和 页面不能用 & 字符, 要用编码
www.aa.com/a.asp?a=a&b=b //错误
www.aa.com/a.asp?a=a&b=b //正确
为什么, 居然要用 ASCII 编码.
下面几个字符都须采用 ASCII 写法. 
------------------------------
& = & (ampersand, U+0026)
< = < (left angle bracket, less-than sign, U+003C)
> = > (right angle bracket, greater-than sign, U+003E)
" = " (quotation mark, U+0022)
' = ' (apostrophe, U+0027)

3. URI

2.1 外部样式表
<style type="text/css">/*<![CDATA[*/ @import "css/css_first/ctarticle.css"; /*]]>*/</style>

2. 页面样式表
<style type="text/css">
/*<![CDATA[*/ 
 div > li * a { color: blue; }
/*]]>*/
</style>

1.1. 外部脚本, 属性须声明.
<script type="text/javascript" src="js/js.js"></script>

1. 页面脚本
<script language="JavaScript" type="text/javascript">
//<![CDATA[
//脚本内容
//]]>
</script>

---/-----------------------------------------------------------

常识

3. 页面 ID 须为唯一, 不能重复.

2. XHTML 标签和属性须用小写, 属性值须用双引号括起来. 

1. XHTML 区分大小写

0. 页顶部
<?xml version="1.0" encoding="UTF-8"?>
//加入该标签请确保你的页面足够严谨.
//或者 IE 不变态.

---/-----------------------------------------------------------

附录

0. 检测 W3 XHTML 标准检测
1. 页面声明
2. html标签 声明
3. xhtml + MathML
4. 属性定义

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

4. 描述定义
Attribute TypeDefinition
CDATACharacter data
IDA document-unique identifier
IDREFA reference to a document-unique identifier
IDREFSA space-separated list of references to document-unique identifiers
NAMEA name with the same character constraints as ID above
NMTOKENA name composed of only name tokens as defined in XML 1.0 [XML]
NMTOKENSOne or more white space separated NMTOKEN values
PCDATAProcessed character data

3. xhtml + MathML
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>A Math Example</title>
  </head>
  <body>
    <p>The following is MathML markup:</p>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <apply> <log/>
        <logbase>
          <cn> 3 </cn>
        </logbase>
        <ci> x </ci>
      </apply>
    </math>
  </body>
</html>

2.2 xhtml 2.0
<html xmlns="http://www.w3.org/2002/06/xhtml2/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2002/06/xhtml2/ http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd">

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

2. html标签 声明

1. 页面声明
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">

XHTML 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

XHTML 2.0
XHTML 2.0 currently (Oct 2005) defines its DOCTYPE as
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml2.dtd">

0. W3 XHTML 标准检测
http://validator.w3.org/

---/-----------------------------------------------------------