Skip to content Skip to sidebar Skip to footer

Selector For An Element With Certain Class, If It Is The One & Only "visible" Child Of Its Parent?

Just today I asked Selector for an element with certain class, if it is the one & only child of its parent? but what about if we need to select elements with a class , if it

Solution 1:

There is no way to determine if an object is "visible" with CSS, so it's not possible. Note that jQuery is also only capable of determining if an object is "visible" for a certain definition of "visible".

Here's an example where it fails:

<body><divstyle="position:absolute; top: -100px">Am I visible?</div></body>

Here is another. Heck, even visibility: hiddenis considered visible. There are lots of creative ways to make something "not visible" to a human, so that term needs a rigorous definition before we are able to start talking tech.

Solution 2:

hope it will help you, we select in css dude, its just example how to select

div > .child:not( [style*='visibility:hidden'] ) {
   border-top:    1px solid #cccccc;
   border-bottom: 1px solid #cccccc;

 }

Demo

another

Demo

Post a Comment for "Selector For An Element With Certain Class, If It Is The One & Only "visible" Child Of Its Parent?"