我试图使用CSS用下面的代码浮动布局不会覆盖所有屏幕
<html>
<head>
<link rel="stylesheet" type'text/css" href="styles.css">
</head>
<body>
<div id="header">
<h1>header</h1>
</div>
<div id="authentification">
<h1>authentification</h1>
</div>
<div id="cart">
<h1>cart</h1>
</div>
<div id="content">
<h1>content</h1>
</div>
<div id="footer">
<h1>footer</h1>
</div>
</body>
和相关的CSS代码做一个浮动的布局:
#header
{
float: left;
background-color: #EAE5DF;
width: 80%;
height: 175px;
}
#authentification
{
width: 20%;
height: 175px;
background-color: #8A5D1D;
float: right;
}
#cart
{
width: 20%;
min-height: 400px;
background-color: #861825;
float: right;
}
#content
{
width: 80%;
min-height: 400px;
background-color: #EAE5DF;
float: left;
overflow: hidden;
}
#footer
{
width: 100%;
min-height: 50px;
background-color: #8A5D1D;
clear: both;
display: table;
}
现在问题是上面的代码显示了divs,因为它们是为了显示,但是在底部留下了空白区域。 2)当div'content'或'cart'获得更多的元素时,可以通过以下方式来获得更多的元素: 2)当div'content'或'cart'比另一个,他们当然应该是相同的高度。
我很感激帮助。
你为什么浴液剩下什么呢? –
在哪一个?你可以运行代码,你会看到。 这里是实际的计划: HEAD \ AUTHENTIFICATION ...... CONTENT \ CART ...... FOOTER – user3785612