css三列浮动中间列宽度自适应
怎么让中间一列也居顶呢?margin-right:94px;和margin-right:93px;我也不明白是怎么算出来的XHTML代码:<divid="left">左栏...
怎么让中间一列也居顶呢?margin-right:94px;和margin-right:93px;我也不明白是怎么算出来的
XHTML代码:
<div id="left">左栏</div>
<div id="center">中间栏</div>
<div id="right">右栏</div>
CSS代码:
div{
background-color:#CF9;
border:1px solid #000;
text-align:center;
padding-top:40px;
font-size:20px;
font-family:"宋体";
font-weight:bold;
color:#F00;
}
div{
background-color:#CF9;
border:1px solid #000;
text-align:center;
padding-top:40px;
font-size:20px;
font-family:"宋体";
font-weight:bold;
color:#F00;
}
#left{
height:300px;
width:100px;
position:absolute;
top:0;
left:0;
}
#right{
height:300px;
width:100px;
position:absolute;
top:0;
right:0;
}
#center{
height:300px;
margin-left:93px;
margin-right:94px;
} 展开
XHTML代码:
<div id="left">左栏</div>
<div id="center">中间栏</div>
<div id="right">右栏</div>
CSS代码:
div{
background-color:#CF9;
border:1px solid #000;
text-align:center;
padding-top:40px;
font-size:20px;
font-family:"宋体";
font-weight:bold;
color:#F00;
}
div{
background-color:#CF9;
border:1px solid #000;
text-align:center;
padding-top:40px;
font-size:20px;
font-family:"宋体";
font-weight:bold;
color:#F00;
}
#left{
height:300px;
width:100px;
position:absolute;
top:0;
left:0;
}
#right{
height:300px;
width:100px;
position:absolute;
top:0;
right:0;
}
#center{
height:300px;
margin-left:93px;
margin-right:94px;
} 展开
展开全部
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
div{
background-color:#CF9;
border:1px solid #000;
text-align:center;
padding-top:40px;
font-size:20px;
font-family:"宋体";
font-weight:bold;
color:#F00;
}
div{
background-color:#CF9;
border:1px solid #000;
text-align:center;
padding-top:40px;
font-size:20px;
font-family:"宋体";
font-weight:bold;
color:#F00;
}
#left{
height:300px;
width:100px;
position:absolute;
top:0;
left:0;
}
#right{
height:300px;
width:100px;
position:absolute;
top:0;
right:0;
}
#center{
height:300px;
position:absolute;
top:0;
right:105px;
left:105px;
}
</style>
</head>
<body>
<div id="left">左栏</div>
<div id="center">中间栏</div>
<div id="right">右栏</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
div{
background-color:#CF9;
border:1px solid #000;
text-align:center;
padding-top:40px;
font-size:20px;
font-family:"宋体";
font-weight:bold;
color:#F00;
}
div{
background-color:#CF9;
border:1px solid #000;
text-align:center;
padding-top:40px;
font-size:20px;
font-family:"宋体";
font-weight:bold;
color:#F00;
}
#left{
height:300px;
width:100px;
position:absolute;
top:0;
left:0;
}
#right{
height:300px;
width:100px;
position:absolute;
top:0;
right:0;
}
#center{
height:300px;
position:absolute;
top:0;
right:105px;
left:105px;
}
</style>
</head>
<body>
<div id="left">左栏</div>
<div id="center">中间栏</div>
<div id="right">右栏</div>
</body>
</html>
参考资料: 大脑
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询