Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8356009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:02:47+00:00 2026-06-09T10:02:47+00:00

Usually, I’m good with CSS, but I can’t seem to figure this one out.

  • 0

Usually, I’m good with CSS, but I can’t seem to figure this one out. If I have a structure of

<div>
    <h2 class="open">1</h2>
    <h2>2</h2>
    <h2>3</h2>
    <h2>4</h2>
    <h2>5</h2>
</div>

how can I target all of the sibling h2s using the .open class with CSS? My main issue is that sibling selectors (.open + h2) will only target the h2 immediately following .open.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:02:48+00:00Added an answer on June 9, 2026 at 10:02 am

    You can select all the following siblings using ~ instead of +:

    .open ~ h2
    

    If you need to select all h2 elements that aren’t .open whether they precede or follow .open, there is no sibling combinator for that. You’ll need to use :not() instead:

    h2:not(.open)
    

    Optionally with a child combinator if you need to limit the selection to div parents:

    div > h2:not(.open)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually wordpress structure for category is as below. http://ourdomain/category/categoryname/subcategoryname but I want my structure
Usually I'm pretty on the ball with CSS and able to figure most of
Usually Python descriptor are defined as class attributes. But in my case, I want
Usually I don't have problems writing assembly and testing and debugging. But then sometimes
Usually I use $("#id").val() to return the value of the selected option, but this
Usually code looks like this: (one-thing (another-thing arg1 (f arg5 r)) (another-thing arg1 (f
Usually powershell script files end with .ps1, and modules end with .psm1. Can one
Usually when I have floating elements inside a container div, I'll have something like
Usually when I build a site, I put all the CSS into one file,
Usually i use SQL Server as database for my project, but one of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.