Estoy intentando incluir dos elementos DIV, inner-1 & inner-2, (borde rojo punteado) dentro de un envoltorio DIV (borde verde sólido) pero el elemento DIV del envoltorio no se expande para encerrar los DIV internos .Elementos DIV anidados
¿Qué estoy haciendo mal?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> Nested divs </title>
</head>
<body>
<div id="wrapper" style="margin-left:auto; margin-right:auto; border:solid #669933;">
content inside "wrapper" div
<div id="inner-1" style="float:left; width:49%; border:dotted #CC3300;">
content <br />
inside <br />
inner-1 div
</div>
<div id="inner-2" style="float:left; width:49%; border:dotted #CC3300;">
content inside inner-2 div
</div>
</div>
</body>
</html>
configuración 'ancho: 100%' y 'desbordamiento: oculto' también funciona para el elemento padre – o01
¿Realmente no hay otra solución que usar Javascript? Estoy teniendo el mismo problema, el div externo no tiene ancho sólido, pero usar Javascript parece una solución. – user1226868
El enlace a la solución definitiva en la publicación anterior se ha movido a [aquí] (http://www.sitepoint.com/simple-clearing-of-floats/) –