Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show Child Div within Hidden Parent Div

Tags:

html

css

How can I show a Child Div while keeping its Parent Div hidden? Can this be done?

My Code is below:

<style>   .Main-Div{    display:none; } </style>  <div class="Main-Div">     This is some Text..     This is some Text..     <div class="Inner-Div'>         <a href="#"><img src="/image/pic.jpg"></a>     </div>     This is some Text..     This is some Text.. </div> 
like image 675
Aki Ross Avatar asked Apr 02 '11 05:04

Aki Ross


1 Answers

Set the parent class's visibility to hidden or collapse. Set the child to visible. Something like this:

.parent>.child {     visibility: visible; }  .parent {   visibility: hidden;   width: 0;   height: 0;   margin: 0;   padding: 0; } 

Full example: http://jsfiddle.net/pread13/h955D/153/

Edited with help from @n1kkou

like image 190
Patrick Read Avatar answered Sep 30 '22 03:09

Patrick Read