CSS: Parent-Div does not grow with it's children (horizontal)

Posted by vyden_st on Stack Overflow See other posts from Stack Overflow or by vyden_st
Published on 2010-03-30T13:02:44Z Indexed on 2010/03/30 13:13 UTC
Read the original article Hit count: 166

Filed under:
|
|
|
|

I would like the parent-div (red) to grow with the green child-div. Now it just stops at the viewport.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="de" xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<head>
<title>simple document</title>
<style type="text/css">
 * {
  font-family: verdana;
  margin: 0px;
  padding: 0px;
 }
</style>
</head>
<body>
<div style="margin: 30px; background: red; padding: 10px;">
 <div style="background: green; width: 2000px;">dxyf</div>
</div>
</body>
</html>

I don't want to use display:table; since it does not work well in IE.

Any ideas?

© Stack Overflow or respective owner

Related posts about css

Related posts about parent