Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display div while parent is display None

I have div that is like this

<div style: "display:none;">
   <div class="displayMe">
   </div>
</div>

I need to how to make the div displayMe show while keeping the parent Div hidden

like image 273
Kevin Mohamed Avatar asked Dec 01 '25 21:12

Kevin Mohamed


2 Answers

you can use this:

//this class for parent div
.hide {visibility: hidden;}
//this class to the child div
.reshow {visibility: visible;}
like image 140
Idan Magled Avatar answered Dec 04 '25 11:12

Idan Magled


It's not totally clear, where exactly you want to show the visible part of the hidden parent. Here's a pure CSS solution, which more or less replaces the parent with a child on screen.

As you can see, there's a drawback in this solution concerning the rest of the content on the page. However, setting display:none removes the hidden element taken space from the textflow, hence this is probably exactly what would happen, if it was possible to show elements inside none-displayed elements.

#wrapper {
    position: relative;
    height: 0px;
    visibility: hidden;
}
#content {
    position: absolute;
    top: 0px;
    visibility: visible;
}
<div id="wrapper">
    Text in the wrapper<br/>
    more text ...<br/>
    ... and one more line.
    <div id="content">Some visible content</div>
    This text is below the visible
</div>
<div>This is outside of invisible</div>
like image 39
Teemu Avatar answered Dec 04 '25 11:12

Teemu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!