Div 边框未显示在正确的位置

Don*_*uma 1 html css border

我有一个带有蓝色边框的 div。这个 div 是页脚,所以它被放置在页面的底部。该 div 内的文本显示在底部,但边框本身显示在顶部。

这是 HTML:

<body>

<div id="header">
this is the header
</div>

<div id="mainleft">
this is the main left
</div>

<div id="mainright">
this is the main right
</div>

<div id="footer">
this is the footer
</div>

</body>
Run Code Online (Sandbox Code Playgroud)

这是CSS:

body{
    background-color:#666666;
}

#header{
    min-height:75px;
    border:3px solid #000099;
}

#mainleft{
    height:500px;
    width:15%;
    border-left:3px solid #000099;
    float:left;
}
#mainright{
    height:500px;
    width:84%;
    border-left:3px solid #000099;
    border-right:3px solid #000099;
    float:right;
}

#footer{
    height:70px;
    width:100%;
    border:3px solid #098099;
    bottom:0px;
}
Run Code Online (Sandbox Code Playgroud)

小智 5

将 a 添加clear: both;到页脚元素。