什么是“+” (加号)CSS选择器是什么意思? [英] What does the "+" (plus sign) CSS selector mean?
问题描述
例如:
p + p {
/* Some declarations */
}
我不知道 +
。这与仅定义 p
的样式之间有什么区别,而没有 + p
?
I don't know what the +
means. What's the difference between this and just defining a style for p
without + p
?
推荐答案
此选择器表示样式仅适用于直接跟在另一个段落后面的段落。
普通的p选择器将应用样式
This selector means that the style applies only to paragraphs directly following another paragraph.
A plain "p" selector would apply the style to every paragraph in the page.
See adjacent selectors on W3.org.
这将只能在IE7上使用。这个选项只适用于W3.org上的rel =nofollow noreferrer或以上。在IE6中,样式不会应用于任何元素。这也适用于>
This will only work on IE7 or above. In IE6, the style will not be applied to any elements. This also goes for the > combinator, by the way.
另请参阅Microsoft的概述 Internet Explorer中的CSS兼容性。
See also Microsoft's overview for CSS compatibility in Internet Explorer.
这篇关于什么是“+” (加号)CSS选择器是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!