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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:11:17+00:00 2026-06-02T02:11:17+00:00

I want to change the style of visible elements using CSS only. Is there

  • 0

I want to change the style of visible elements using CSS only. Is there a selector that does it? It needs to work with Chrome and Firefox only. (I am building an extension / addon)

If there isn’t, is there a way to change the style of visible elements with a light javascript?


Visible within the current scroll position. An element can be out of the scroll vision, or partially visible.

  • 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-02T02:11:19+00:00Added an answer on June 2, 2026 at 2:11 am

    There is no standard pure CSS rule for assessing visibility.

    As others have said, jQuery (if you wanted to use jQuery) has both a CSS selector extension :visible and the ability to execute .is(':visible') on any given jQuery object to get the computed style on any given DOM element with .css("display") or .css("visibility").

    It’s not particularly simple in plain javascript to determine if an object is visible because you have to get the computedStyle (to take into account all possible CSS rules that might be affecting the element) and you have to make sure no parent objects are hidden causing the child element to be hidden. This is a function I have in my own personal library:

    //----------------------------------------------------------------------------------------------------------------------------------
    // JF.isVisible function
    //
    // Determines if the passed in object is visible (not visibility:hidden, not display: none 
    // and all parents are visible too.
    //
    // Source: http://snipplr.com/view/7215/javascript-dom-element-visibility-checker/
    //----------------------------------------------------------------------------------------------------------------------------------
    JF.isVisible = function(obj)
    {
        var style;
    
        if (obj == document) return true;
    
        if (!obj) return false;
        if (!obj.parentNode) return false;
        if (obj.style) {
            if (obj.style.display == 'none') return false;
            if (obj.style.visibility == 'hidden') return false;
        }
    
        //Try the computed style in a standard way
        if (window.getComputedStyle) {
            style = window.getComputedStyle(obj, "")
            if (style.display == 'none') return false;
            if (style.visibility == 'hidden') return false;
        } else {
            //Or get the computed style using IE's silly proprietary way
            style = obj.currentStyle;
            if (style) {
                if (style['display'] == 'none') return false;
                if (style['visibility'] == 'hidden') return false;
           }
        }
    
        return JF.isVisible(obj.parentNode);
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does the css visibility style collapse work in IE8? The reason I ask this
I want to change font style of a control , for a short time.
I want to change the link-style for some of my links, like this: a:hover
I have style sheet with a class name changebackgroundcolor i want make change in
I want that part 1 onclick div style changes and part 2 again on
I have a listview and want to change its style to display:none on pageload
I want to change my window template, eg: <Style x:Key=SilverGreenWindowStyle TargetType={x:Type Window}> <Setter Property=Template>
I have a script that will change the opacity of elements when they are
I want to change the style (second line below) to remove the display: none;
I want to change a textblock color or style in code with a Viewmodel

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.