Is there a way to hide all divs inside of a parent div/container by adding an inline style to parent?

Viewed 25109

I am trying to figure out if it is possible to hide all child divs inside of a parent container by adding an inline style to the parent div. I have tried both visibility: hidden; and display: none; Neither one seem to hide the child divs. I was thinking I could just use some jquery to loop through all child divs and add an inline style to each one, although I figure there must be a way that works.

Here is an example:

CSS

  .hero-content {
      text-align: center;
      height: 650px;
      padding: 80px 0 0 0;
    }

    .title, .description {
      position: relative;
      z-index: 2
    }

HTML

<div class="hero-content">
   <div class="title"> This is a title </div>  
   <div class="description"> This is a description</div>  
</div>
7 Answers

You can affect all the children P tags like this, as well

.hero_content {
  display: none;
}

.hero_content P {
  display: none;
}

Related