CSS:Div定位。。。帮助
看看这个。我希望左侧和右侧框(DIVs)显示在一行中。。如何做CSS:Div定位。。。帮助,css,html,Css,Html,看看这个。我希望左侧和右侧框(DIVs)显示在一行中。。如何做a b <div><div style="float:left">a</div> <div style="float:left">b</div></div> <div style="clear:both"></div> 将左右两个div向左浮动并清除页脚。您还需要调整左侧和右侧div的宽度,使其适合同一行 #left { posi
a b
<div><div style="float:left">a</div> <div style="float:left">b</div></div>
<div style="clear:both"></div>
将左右两个div向左浮动并清除页脚。您还需要调整左侧和右侧div的宽度,使其适合同一行
#left
{
position:static;
width: 40%;
height: 50px;
margin-top: 10px;
margin-right: 10px;
background: #111111;
border: solid 3px #ff0000;
float: left;
}
#right
{
position:static;
width: 40%;
height: 50px;
margin-top: 10px;
margin-right: 10px;
background: #111111;
border: solid 3px #ff0000;
float: left;
}
#footer
{
position: static;
width : 100%;
height : 50px;
margin-top: 10px;
background: #111111;
border: solid 3px #ff0000;
text-align: center;
clear: both;
}
我是这样做的,但是现在我的边框没有对齐成一条直线,您正在将标题的宽度设置为100%,即300px。然后添加边框时,它将添加到此div的外部。这意味着头的实际宽度为300+2*3=306px。您需要决定是否要将边框放在容器内,并相应地调整宽度。我这样做了,但现在我的边框没有对齐成一条直线