如何設置僅用於非「旋轉」元素的樣式?設置僅用於非旋轉元素的樣式
例如:
<input id="1"/>
<input id="2"/>
<input id="3"/>
<input id="4"/>
輸入3懸停。我希望它具有默認值。
input {
background-color:red;
}
如何設置僅用於非「旋轉」元素的樣式?設置僅用於非旋轉元素的樣式
例如:
<input id="1"/>
<input id="2"/>
<input id="3"/>
<input id="4"/>
輸入3懸停。我希望它具有默認值。
input {
background-color:red;
}
我不完全明白你問什麼,但是這可能幫助
input:not(:hover) {
}
由作爲CSS3選擇器的方式,所以它不支持舊版瀏覽器。
http://kilianvalkhof.com/2008/css-xhtml/the-css3-not-selector/
可惜的是它並不在IE瀏覽器(9):( – Max 2012-03-13 14:42:24
不知道你在找什麼,但嘗試了這一點:
input {
background-color:blue;
}
input:hover {
background-color:red;
}
我不知道你所說的 「不可不徘徊」 的意思。這樣做的方法是設置默認的樣式,然後爲「懸停」一個單獨的樣式:
input {
background-color: red;
}
input:hover {
background-color: grey;
}
我需要「輸入:懸停」要像一些其他風格 – Max 2012-03-13 14:44:49
設定值,我不認爲我明白你想說什麼一樣。 – 2012-03-13 14:46:28
取消它在懸停的元素:
input {
background-color: red;
}
input:hover {
background-color: transparent;
}
transparent
是默認值背景 - 如果沒有設置顏色,則顯示顏色,因此顯式設置將強制它爲默認值。
有我的理解是正確的,如果你想要的時候他們都不是徘徊每個輸入項(全4人),一個默認狀態,當一個項目懸停所有其他獲得另一種風格?
input {
background-color: red; /* this is the default when none is hovered */
}
#containerForInputs:hover input {
background-color: yellow; /* this is the default for all except the one item that is hovered */
}
#containerForInputs input:hover {
background-color: blue; /* this is the style for the hovered item */
}
類似的東西:
如果是這樣,也許你可以用這樣做呢? (我還沒有嘗試過自己,但我認爲它應該工作)
你是什麼意思*默認值* - 任何它是,如果你不將它設置爲紅色? – 2012-03-13 13:40:30
什麼是雙重否定? – BoltClock 2012-03-13 13:40:55
作爲「默認」,我指的是其他樣式已設置的樣式,例如:div> input {background-color:yellow}。這只是一個例子,還有更多的選擇器。 – Max 2012-03-13 14:46:46