2

I am bit confused to achieve following thing 1. disable visibility of one parent div 2. but child div visibility are allowed by another code

<div style="background-color:#999 ; height:80px;visibility:hidden">
    <div style="background-color:#550; height:30px;"></div>
    <div style="background-color:#900; height:30px;visibility:visible"></div>
</div>

http://jsfiddle.net/cbXxU/

I want to hide all the child div if parent div is not visible or any suggestion for this.

Ashish Kasma
  • 3,594
  • 7
  • 26
  • 29
  • in your fiddle you dont have any children – iConnor Feb 27 '13 at 15:00
  • 2
    take VisioN's advice if you add display:none; to your parent then every child will be gone! – iConnor Feb 27 '13 at 15:00
  • See the difference between display: none; and visibility: hidden; http://stackoverflow.com/questions/133051/what-is-the-difference-between-visibilityhidden-and-displaynone – peter.svintsitskiy Feb 27 '13 at 15:02
  • but website is having large base code, so it calculates height of few div based on the parent height, so keeping display:none is not useful for me. I already tried this before using visibility style. – Ashish Kasma Feb 27 '13 at 15:15

1 Answers1

3

Set display: none for parent element. To make it visible use display: block.

DEMO: http://jsfiddle.net/cbXxU/1/

VisioN
  • 143,310
  • 32
  • 282
  • 281
  • but website is having large base code, so it calculates height of few div based on the parent height, so keeping display:none is not useful for me. I already tried this before using visibility style. – Ashish Kasma Feb 27 '13 at 15:09