The Wayback Machine - https://web.archive.org/web/20240118174353/https://www.geeksforgeeks.org/what-does-the-plus-sign-css-selector-mean/
Open In App
Related Articles

What does the “+” (plus sign) CSS selector mean?

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

The “+” sign selector is used to select the elements that are placed immediately after the specified element but not inside the particular elements.

Note: The IE8 and earlier versions </DOCTYPE> must be declared to work element + element selector.

Syntax:

element + element {
    // CSS property
} 

Example:




<!DOCTYPE html>
<html>
    <head>
        <title>+ sign selector</title>
        <style>
            h2 + div {
                font-size:20px;
                font-weight:bold;
                display:inline;
                background-color: yellow;
                color:green;
            }
            h1 {
            color:green;
            }
            body {
                text-align:center;
            }
        </style>
    </head>
    <body>
        <h1>GeeksforGeeks</h1>
        <h2>+ sign Selector</h2>
        <div>A computer science portal for geeks</div>
    </body>
</html>                    


Output:

Supported Browsers: The browser supported by “+” selector are listed below:

  • Apple Safari
  • Google Chrome
  • Firefox
  • Opera
  • Internet Explorer 7.0
Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 04 Dec, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials