IMG-LOGO

What does the plus sign in CSS selector mean?

andy - 11 Oct, 2019 4237 Views 0 Comment

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.

Related Articles

How to draw a circle in CSS?

In this article, we are going to learn how to draw a circle in CSS. Firstly what needs to do is to create a CSS class called circle.

How to create rounded image using CSS3?

In this tutorial you will learn on how to create a rounded image in CSS3. We will use CSS property called border-radius to create this rounded image effect.