MdFarzan
MdFarzan

Reputation: 390

Unable to hide inner element with height or width 0px

I want to toggle a div using it's width or height. But when i am setting it's width to 0 it's inner element is visible. So, how to achieve this toggle width functionality?

js fiddle

a {
  display: block;
}

div {
  width: 100%;
  background: black;
  color: orange;
}

div {
  width: 0;
}
<div>
  <p>This is a para</p>
</div>

Upvotes: 0

Views: 292

Answers (1)

John
John

Reputation: 5335

Add overflow: hidden; do the div in css.

Upvotes: 2

Related Questions