Published on: 11 Oct, 2019

What does the plus sign in CSS selector mean?

Tumblr Digg Google Plus

The plus sign in CSS selector is used when you want to select an element right after the element specified on the left side of the plus sign. Have a look into the following CSS example.

p + h5 {
	color: blue;
}

If we have the following example HTML code. The color of the H5 will be changed to blue color.

<p>This is a paragraph.</p>
<h5>This is a sample h5 heading text.</h5>

However the above rule will not be applied for the following HTML code. Because for this example, after the p tag it is a div tag element, not an h5 element.

<p>This is a paragraph.</p>
<div>This is a div tag example.</div>
<h5>This is a sample h5 heading text.</h5>

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.