我不知道这是不是一个常见的问题,但是到目前为止我还没有在网络上找到解决方案. 我希望将两个div包装在另一个div中,但是里面的这两个div必须对齐相同的级别(例如:左侧一个占用wrappedDiv的20%宽度,右侧一个占用另外80%的宽度).为了实现此目的,我使用了以下示例CSS.然而,现在WRAP DIV并没有包装所有的div.WRAP Div的高度比里面包含的那两个div小.如何确保WRAP Div具有与包含的div相同的最大高度?谢谢!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>liquid test</title>
<style type="text/css" media="screen">
body
{
margin: 0;
padding: 0;
height:100%;
}
#nav
{
float: left;
width: 25%;
height: 150px;
background-color: #999;
margin-bottom: 10px;
}
#content
{
float: left;
margin-left: 1%;
width: 65%;
height: 150px;
background-color: #999;
margin-bottom: 10px;
}
#wrap
{
background-color:#DDD;
height:100%;
}
</style>
</head>
<body>
<div id="wrap">
<h1>wrap1 </h1>
<div id="nav"></div>
<div id="content"><a href="index.htm">< Back to article</a></div>
</div>
</body>
</html>