我为所有图片定义了一种风格:
img {
border-top-right-radius: 30px;
border-bottom-left-radius: 30px;
}
我想以不同方式设置另一组图像。我为他们创建了一个类:
.radius {
border-radius: 10px;
}
然而,它似乎没有改变目标图像。据我所知,类选择器的优先级高于元素选择器。我出错的任何建议?
答案 0 :(得分: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
例如,您可以使用tag + class
来增加特异性img.radius {
border-radius: 10px;
}
Here来自SM的好文章