Skip to content Skip to sidebar Skip to footer

Make Child Elements Not Affect Width, But Affect Height Of A Parent Li?

If you have a simple 2 layer list like so:

Solution 1:

By positioning your second level list absolutely you'll take it out of the natural flow of the document.

This will stop the first level li from expanding to accomodate the size of the second level ul

ul li {
  position:relative;
}
ul li ul{
  position:absolute;
}

Working example


Post a Comment for "Make Child Elements Not Affect Width, But Affect Height Of A Parent Li?"