2013-04-02 44 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