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

  • Home
  • SEARCH
  • 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 9209011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:44:34+00:00 2026-06-18T00:44:34+00:00

I have a CSS3 rule that I want to make hide everything inside a

  • 0

I have a CSS3 rule that I want to make hide everything inside a given element except for any headers, until the user hovers over it. Which way would be a better choice? Keep in mind that, in this case, I’m not worried about backwards-compatibility with CSS2.1

Idea 1


SECTION FIGURE.collapsed:not(:hover) *:not(H1):not(H2):not(H3):not(H4):not(H5):not(H6){
    display:none;
}

Pro: does it all in one selector

Con: looks unstable and I feel like it’s a bit ambiguous

Idea 2


SECTION FIGURE.collapsed *{
    display:none;
}
SECTION FIGURE.collapsed:hover *{
    display:initial;
}


SECTION FIGURE.collapsed H1,
SECTION FIGURE.collapsed H2,
SECTION FIGURE.collapsed H3,
SECTION FIGURE.collapsed H4,
SECTION FIGURE.collapsed H5,
SECTION FIGURE.collapsed H6{
    display:block;
}

Pro: Classic CSS, easier to understand

Cons: Overrides previously set styles; doesn’t seem like display:initial; is valid CSS, though it works.

  • 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-18T00:44:35+00:00Added an answer on June 18, 2026 at 12:44 am

    I think a combination of what you have would be best. You can eliminate the display: initial by doing the :not(:hover) but reset all the heading elements (which normally would have been display: block anyway.

    Update: needed to get the selector specificity up by adding :not(:hover) to all. See fiddle. (Note: the h2.1 tag is still hidden because it is inside a div [this is what BoltClock noted in his discussion]).

    SECTION FIGURE.collapsed:not(:hover) * {
        display:none;
    } 
    
    SECTION FIGURE.collapsed:not(:hover) H1,
    SECTION FIGURE.collapsed:not(:hover) H2,
    SECTION FIGURE.collapsed:not(:hover) H3,
    SECTION FIGURE.collapsed:not(:hover) H4,
    SECTION FIGURE.collapsed:not(:hover) H5,
    SECTION FIGURE.collapsed:not(:hover) H6{
        display:block;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a customized show/hide toggle script that I'm using along with CSS3 transitions
I have a <span> that I want to rotate. I am using HTML5, CSS3,
I have an HTML structure which has css3 inside e.g. @-webkit-keyframes,..etc Is there any
I have this CSS3 animation that works in Chrome .circle-label-rotate { -webkit-animation-name: rotateThis; -webkit-animation-duration:.5s;
I have a very complicated site built on CSS3 that has html elements 3d-transformed,
I have the following setup: <div>Element with CSS3 animated height change</div> <div><a href=#>Link</a></div> I
Is there a way to have CSS3 transitions/animations for a div that's just been
I have a CSS3 animation, that simply moves a <div> down (via top: 0px;
In my CSS I have a rule that must be applied to all text
I have a CSS3 animation that needs to be restarted on a click. It's

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.