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 7675117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:53:21+00:00 2026-05-31T16:53:21+00:00

Sometimes it appears helpful to make certain page elements only visible on e.g. hovers.

  • 0

Sometimes it appears helpful to make certain page elements only visible on e.g. hovers. An example is stackoverflow’s “feedback – Was this post useful to you?”-widget. As those elements might be crucial to the interface, such a show-on-hover-feature should be a progressive enhancement or, in other terms, unobtrusive and degrade gracefully.

The usual way appears to be employing javascript, e.g. hiding the elements and making them available when a parent element is hovered. The reason for that choice might be :hover is not support for all elements especially in legacy browsers, thereby forbidding you to hide elements in the first place up to css2. (for a js/jQuery example cf. jquery showing elements on hover)

I wonder if you can achieve such a feature safely* with pure css3, using :not(:hover) and :hover, not affecting older browsers. As far as I can see, the requirement is that every browser supporting :not() must support :hover for all elements. According to the following sources, that appears to be the case

  • http://www.quirksmode.org/css/contents.html
  • http://kimblim.dk/css-tests/selectors/

Example implementation: http://jsfiddle.net/LGQMJ/

What do you think? Any objections or other sources?

*by safely I mean the browser should always show all elements as a last resort.

  • 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-05-31T16:53:22+00:00Added an answer on May 31, 2026 at 4:53 pm

    Your solution looks alright for CSS3. There isn’t anything I can think of to improve your solution for modern browsers as the opacity property will never be applied by browsers that don’t support it anyway.

    There is literally no other browser besides IE6 and NN4 (and older) without support for :hover on elements other than a. As implied in your question, all browsers that support :not() are known to also fully support :hover.

    That said, you end up leaving IE7 and IE8 missing out on the hover effect, the latter of which is still quite prevalent. You’re probably looking to support IE6 as well, but here’s a solution that I believe will address these concerns, if you need it:

    1. Omit :not(:hover) altogether so your first selector becomes less specific rather than equally specific to your second selector with :hover, and you can reach out to IE7 and IE8 which don’t support :not() but do support :hover on all visual elements:

      div span.question {
          opacity: 0;
      }
      div:hover span.question {
          opacity: 1;
      }
      
    2. Use the visibility property instead of the opacity property to reach out to IE7 and IE8 which don’t support CSS3 opacity:

      div span.question {
          visibility: hidden;
      }
      div:hover span.question {
          visibility: visible;
      }
      

      Keep in mind that visibility: hidden will make an element invisible to mouseovers as well, but in this case you’re applying it to a child element, so the parent will remain visible to mouseovers.

    3. Use CSS2/3 combinators that IE6 doesn’t support but IE7 and IE8 do (child >, adjacent sibling +, general sibling ~) to hide both rules from IE6. This borders on “hacky”, but your situation is one where the child combinator > fits very well, so it can be integrated organically rather than hacked in like the famous html > body filter:

      div > span.question {
          visibility: hidden;
      }
      div:hover > span.question {
          visibility: visible;
      }
      

    Updated fiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes appears this arrow so I cannot see if breakpoint is installed. Does it
Sometimes on an R help page the phrase not run appears in comments. Check
When i run this program, it appears that sometimes 55 will be printed out,
Possible Duplicate: Why do I get a emulator-5554 disconnected message this error appears sometimes
We have some input data that sometimes appears with &nbsp characters on the end.
I have a div behind the main div. Sometimes it appears and sometimes it's
I'm working on a WPF application that sometimes exhibits odd problems and appears to
Sometimes when I'm editing page or control the .designer files stop being updated with
Sometimes a labeled break or continue can make code a lot more readable. OUTERLOOP:
I've got a view that sometimes appears as a pushed view of uinavigationcontroller, and

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.