当前位置:首页 > 文章评论 > 评论内容

10.web标准中定义id与class有什么区别吗

共有 3 位网友发表了评论 我要评论..
fishertaotao(211.155.*.*) 发表于:2010-09-07 13:59:56
那么不同页面可以使用相同id吗
管理员回复:可以呀
MicroCode(111.76.*.*) 发表于:2010-05-06 16:19:49
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh"> <head profile="http://www.w3.org/2000/08/w3c-synd/#"> <meta http-equiv="content-language" content="zh-cn" /> <meta http-equiv="content-type" content="text/html;charset=gb2312" /> <title>blueidea</title> <style type="text/css"> /*<![CDATA[*/ .bb{ color:red } .aa { color:blue } /*]]>*/ </style> </head> <body> <div class="aa bb"> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa </div> </body> </html> 为什么颜色会是blue啊??
管理员回复:对呀,因为在css里边,bb在aa下边呀
Ckoen(58.49.*.*) 发表于:2009-12-05 06:36:03
管理員,我是初學者。闗於本文中提到的“属性的优先级问题,ID 的优先级要高于class”,我的理者是如果一個標簽同時定義了両個相同屬性,而値不一樣的話,後面的屬性値會覆蓋前面的,這是不是所謂的優先権呢?但我看了前一例代碼,ID在前面,CLASS在後,而DIV同樣採用的CLASS屬性?我的在IE6下試的。
管理员回复:是这样的,但也得看你的css选择器的写法

我要评论