Stas Bichenko
Stas Bichenko

Reputation: 13263

Don't resize child div when parent div changes size

Consider the following markup

<div id="container"><div id="child"></div></div>

I need the #child not to change it's width when the #container is being resized (for example, when resizing browser window). How can this be done using css without fixing the child's width?

Also, is it possible to allow decrease in child's width but forbid increase?

Upvotes: 0

Views: 4004

Answers (1)

Koen Peters
Koen Peters

Reputation: 12916

You could make the child div's display: "inline" or "inline-block"

#child {
  display: inline-block;
}
​

Upvotes: 1

Related Questions