Html CSS 3列浮点(2个固定,1个动态)
我正在设计一个由3部分组成的标题 页面必须是流体:Html CSS 3列浮点(2个固定,1个动态),html,css,layout,Html,Css,Layout,我正在设计一个由3部分组成的标题 页面必须是流体:最小宽度:940px;最大宽度:1200px 收割台的前两部分为固定尺寸: left middle right <---------><---------><-----------------> 134px 183px (Fill the remaining space) 试试这个: <html> <head> <tit
最小宽度:940px;最大宽度:1200px代码>
收割台的前两部分为固定尺寸:
left middle right
<---------><---------><----------------->
134px 183px (Fill the remaining space)
试试这个:
<html>
<head>
<title>Three columns</title>
<style type="text/css">
div.main { background-color: #000; }
div.left { float: left; width: 134px; height: 191px; background-color:#0000ff; }
div.middle { float: left; width: 183px; height: 191px; background-color:#ffff00; }
div.right { height: 191px; background-color: #ff0000; margin-left: 317px; }
</style>
</head>
<body>
<div class="main">
<div class="left"></div>
<div class="middle"></div>
<div class="right"></div>
</div>
</body>
</html>
三列
div.main{背景色:#000;}
div.left{float:left;宽度:134px;高度:191px;背景色:#0000ff;}
div.middle{float:左;宽度:183px;高度:191px;背景色:#ffffff00;}
右分区{高度:191px;背景色:#ff0000;左边距:317px;}
我没有足够的声誉发表评论,但我只是想认可前面答案的正确性。我在寻找一些稍微不同的东西:固定液体固定,所以调整如下:
<html>
<head>
<title>Three columns</title>
<style type="text/css">
div.main { background-color: #000; }
div.left { float: left; width: 134px; height: 191px; background-color:#0000ff; }
div.middle { height: 191px; background-color: #ff0000; margin-left: 134px; margin-right: 183px;}
div.right { float: right; width: 183px; height: 191px; background-color:#ffff00; }
</style>
</head>
<body>
<div class="main">
<div class="left"></div>
<div class="right"></div>
<div class="middle"></div>
</div>
</body>
</html>
三列
div.main{背景色:#000;}
div.left{float:left;宽度:134px;高度:191px;背景色:#0000ff;}
div.middle{高度:191px;背景色:#ff0000;左边距:134px;右边距:183px;}
div.right{float:right;宽度:183px;高度:191px;背景色:#ffffff00;}
注意要点:
-带有浮动的边距用于防止主体与边重叠。
-在我的例子中,需要颠倒html中div的顺序
-实际上,“中间”不需要一个div。quirksmode博客(它只是直接在“body”元素上设置边距):填补页眉或页面其余部分的空白?
<html>
<head>
<title>Three columns</title>
<style type="text/css">
div.main { background-color: #000; }
div.left { float: left; width: 134px; height: 191px; background-color:#0000ff; }
div.middle { float: left; width: 183px; height: 191px; background-color:#ffff00; }
div.right { height: 191px; background-color: #ff0000; margin-left: 317px; }
</style>
</head>
<body>
<div class="main">
<div class="left"></div>
<div class="middle"></div>
<div class="right"></div>
</div>
</body>
</html>
<html>
<head>
<title>Three columns</title>
<style type="text/css">
div.main { background-color: #000; }
div.left { float: left; width: 134px; height: 191px; background-color:#0000ff; }
div.middle { height: 191px; background-color: #ff0000; margin-left: 134px; margin-right: 183px;}
div.right { float: right; width: 183px; height: 191px; background-color:#ffff00; }
</style>
</head>
<body>
<div class="main">
<div class="left"></div>
<div class="right"></div>
<div class="middle"></div>
</div>
</body>
</html>