作者TonyQ (骨头)
看板Web_Design
标题Re: [问题]有关CSS的宣告
时间Wed Feb 28 15:54:51 2007
※ 引述《Bigjapon (Bigjapon)》之铭言:
: 请问一下各位高手:
: 我在一本书上看到说,CSS宣告的时候
: 使用style attribute 者有最高优先权
: 使用<style>元素定义的区块为第二优先
: 使用<link>元素去连结独立样式表为第三优先
: 使用@import为最後
: 我看了很久,还是搞不懂style attribute是啥东西????
: 请各位告诉我吧....
attribute是网页元件的属性
比方说 <input type="text" id="hi" name="hi">
type、id、name就是 input的attribute
input则是这个element的nodeName
在JavaScript里面有所谓的getAttribute和setAttribute,
如果有谐此道者应该很能理解。
所以这里说的Style attribute就是说
<span
style="color:red;" >hi</span>
标色这一段就叫style attribute, 不过不只这种用法啦。
比方说
<style type="text/css">
a:link { color: #006666; }
A:visited { COLOR: #006666;}
A:hover { COLOR: #CC9933; }
</style>
这也是对nodeName 为a的元件设定style attribute。
────────────────────────────────
你前文所叙述的是当一个元件同时被多个style条件约束的时候,
那个元件应该要参照哪一个。
不过如果你连style attribute都看不懂,这段可能很难理解。
比方说
我在网页内用了前面所写的 <style>... 叙述
但是我 又写了一个这样的东西,
<a href="whobirdit.asp" style="color:#000000;"> what?</a>
这时候 它应该要先参照前面的通用style ,
还是要参照我们所设定的Style?
根据你post的内容中有提到的,style attribute有最高优先权。
实际上意思就是以实际在元件上设定的style最高优先。
就是不管你外面怎麽设定 以我们在<a href ...> 这段设定的为准。
意思是这样。:)
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.practice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68