Re: [問題]有關CSS的宣告

看板Web_Design作者 (骨頭)時間19年前 (2007/02/28 15:54), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《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
文章代碼(AID): #15vJLDQi (Web_Design)
討論串 (同標題文章)
文章代碼(AID): #15vJLDQi (Web_Design)