2013-04-02 46 views
0

我已經定義了一個樣式的所有圖片:剔除一個特定的風格

img { 
    border-top-right-radius: 30px; 
    border-bottom-left-radius: 30px; 
} 

我想以不同的樣式另一組圖像。我爲他們創建了一個類:

.radius { 
    border-radius: 10px; 
} 

但是,它似乎沒有改變目標圖像。據我所知,類選擇器比元素選擇器具有更高的優先級。任何建議,我哪裏出錯了?

+2

**如果你去大膽的所有文字,爲什麼要使用粗體?** – BoltClock

回答

1

有無人看http://www.w3.org/TR/css3-selectors/#specificity

A selector's specificity is calculated as follows: 

- count the number of ID selectors in the selector (= a) 
- count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b) 
- count the number of type selectors and pseudo-elements in the selector (= c) 
- ignore the universal selector 

例如,您可以通過使用標籤+類

img.radius { 
    border-radius: 10px; 
} 

Here好文章從SM增加你的特異性

+0

謝謝Antonello。奇怪的是,它似乎還沒有工作。我指定使用兩個HTML選擇器,這就是訣竅。 – rocket

+0

'a img {border-radius:10px; \t margin:0 auto; \t display:block; }」 – rocket