Re: [問題] CSS hack !important的用法
※ 引述《oj113068 (橘子汁)》之銘言:
: 大家好,又來問問題了Orz
: 我想要確認一下把CSS的屬性提高優先的「!important」的用法
: 因為想要利用他區別不同的瀏覽器
: 雖然查到他是「IE6不會讀取這一行,會直接往下一行讀取」
: 可是我發現如果我是這麼寫的
: .style{overflow:hidden!important;}
: IE6還是會執行overflow:hidden
: 但如果我用
: .style{overflow:hidden!important;
: overflow:none;}
: 他就會執行overflow:none;
: 可是這樣很奇怪
: 這樣並不是「IE6不會讀取這一行,會直接往下一行讀取」,
: 而是「FF等瀏覽器優先讀取overflow:hidden!important;」
: 請問他的用法和原理是什麼呢?我有點被搞迷糊了Orz
: 附註:雖然說overflow:hidden在IE6應該是不能被內部的浮動DIV展開,不過這次用了
: CSS REST以後似乎就可以了...
case 1
同一定義區塊下 先 一般後 important
http://jsfiddle.net/6RTxY/
ie6 important 勝 chrome important 勝
case 2
同一定義區塊下 先important 後一般
http://jsfiddle.net/6RTxY/1/
ie6 一般勝 chrome important 勝
所謂的不認識指的是這裡的行為不一致。
case 3
不同定義區塊下 先important 後一般
http://jsfiddle.net/6RTxY/3/
ie6 important 勝 chrome important 勝
case 4
http://jsfiddle.net/6RTxY/4/
不同定義區塊下 先 一般後 important
ie6 important 勝 chrome important 勝
try it by your self.
--
I am a person, and I am always thinking .
Thinking in love , Thinking in life ,
Thinking in why , Thinking in worth.
I can't believe any of what ,
I am just thinking then thinking ,
but worst of all , most of mine is thinking not actioning...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.137.61.228
※ 編輯: TonyQ 來自: 114.137.61.228 (10/18 23:15)
→
10/18 23:17, , 1F
10/18 23:17, 1F
→
10/18 23:17, , 2F
10/18 23:17, 2F
→
10/18 23:18, , 3F
10/18 23:18, 3F
→
10/18 23:18, , 4F
10/18 23:18, 4F
→
10/18 23:19, , 5F
10/18 23:19, 5F
→
10/18 23:20, , 6F
10/18 23:20, 6F
推
10/18 23:22, , 7F
10/18 23:22, 7F
→
10/18 23:22, , 8F
10/18 23:22, 8F
→
10/18 23:22, , 9F
10/18 23:22, 9F
→
10/18 23:22, , 10F
10/18 23:22, 10F
→
10/18 23:24, , 11F
10/18 23:24, 11F
推
10/18 23:25, , 12F
10/18 23:25, 12F
→
10/18 23:25, , 13F
10/18 23:25, 13F
→
10/19 20:18, , 14F
10/19 20:18, 14F
→
10/19 23:56, , 15F
10/19 23:56, 15F
推
10/20 00:33, , 16F
10/20 00:33, 16F
→
10/20 00:34, , 17F
10/20 00:34, 17F
→
10/20 00:35, , 18F
10/20 00:35, 18F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):