Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
365 views
in Technique[技术] by (71.8m points)

css - “ +”(加号)CSS选择器是什么意思?(What does the “+” (plus sign) CSS selector mean?)

For example:

(例如:)

p + p {
  /* Some declarations */
}

I don't know what the + means.

(我不知道+是什么意思。)

What's the difference between this and just defining a style for p without + p ?

(这是什么之间的区别,只是定义样式p ,而不+ p ?)

  ask by gday translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

See adjacent selectors on W3.org.

(请参阅W3.org上的相邻选择器 。)

In this case, the 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.

(一个普通的p选择器会将样式应用于页面中的每个段落。)


This will only work on IE7 or above.

(这仅适用于IE7或更高版本。)

In IE6, the style will not be applied to any elements.

(在IE6中,样式不会应用于任何元素。)

This also goes for the > combinator, by the way.

(顺便说一句,这也适用于>组合器。)

See also Microsoft's overview for CSS compatibility in Internet Explorer .

(另请参阅Microsoft 在Internet Explorer中的CSS兼容性概述。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...