我怎样才能让这个在HTML/CSS(无JavaScript的!!):如何使用html和css创建这个特定的布局?
一切都应该是一个div,里面有液体宽度内。
它只能在Google Chrome中工作。
我只是无法弄清楚这一点。
我怎样才能让这个在HTML/CSS(无JavaScript的!!):如何使用html和css创建这个特定的布局?
一切都应该是一个div,里面有液体宽度内。
它只能在Google Chrome中工作。
我只是无法弄清楚这一点。
@Bmaster
嗨,老兄,我摆弄周围,终于找到了我认为是你“再要求...看看:
对我来说是越来越文本决定整个事情的高度最难的部分 - 但之后,我不再试图用花车,它都解决了;)
尝试增加一些文字,等等它应该工作!
编辑:我不确定你是否想要顶部的'header',但是我在这里放置了一个:http://jsfiddle.net/bHhd8/。 *注意,它在包装外,否则侧栏会变得太高!
这里有一个良好的开端: http://matthewjamestaylor.com/blog/perfect-3-column.htm
你的div需要一个固定的高度不应该需要经过这么多的工作。
我看不出如何帮助我解决最烦人的问题,那就是如何让盒子坚持到底部。 – bmaster 2011-01-26 22:11:58
有一些它我不喜欢,但它确实有效。
<!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>
<title>Test</title>
<style type="text/css">
body
{
padding: 0;
margin: 0;
}
#content
{
background-color: #cccccc;
min-height: 100%;
}
#header
{
height: 40px;
background-color: #666666;
}
#left
{
float: left;
width: 33%;
}
#mid
{
margin: 0 33%;
background-color: #6666ff;
}
#right
{
float: right;
width: 33%;
margin-top: -50px;
}
.fixedHeight
{
height: 50px;
background-color: #ffff33;
}
#left .fixedHeight
{
margin-right: 10px;
margin-bottom: 10px;
}
#right .fixedHeight
{
margin-left: 10px;
}
.clear
{
clear: both;
}
</style>
</head>
<body>
<div id="header">
header
</div>
<div id="content">
<div id="left">
<div class="fixedHeight">
fixed
</div>
<div class="fixedHeight">
fixed
</div>
</div>
<div id="mid">
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
</div>
<div class="clear"></div>
<div id="right">
<div class="fixedHeight">
fixed
</div>
</div>
</div>
</body>
</html>
尝试使用css网格,如the liquid extension for blueprint。这将解决所有宽度问题。然后对于底部的div,你只需要一些绝对的定位设置,它应该没问题。
由于ornage盒子的高度是固定的,所以可以绝对放置它们。对于右下角的。这应该是自explanitory:
.orange-box {
width:33%;
height:100px;
position:absolute;
}
.orange-box.top-left-1 { top:0; left:0; }
.orange-box.top-left-2 { top:100px; left:0; }
.orange-box.bottom-right { bottom:0; right:0; }
蓝色区域应与另一个DIV
width:33%;
margin:0 auto
在审查了其他似乎并不完全得到你想要的答案后,我决定抛出我自己的jsfiddle answer。
比解决问题更重要的是帮助您了解解决方案,这需要了解floats,clears和positioning。
这些列由#footer
清除,它当前不包含任何内容,但有助于将页面大小扩展到包装以外。
#page
元素相对定位,因此绝对定位的子元素将相对于它定位,而不是body
。
谢谢你帮助我理解,+1 – bmaster 2011-01-30 02:14:37
+1对于一个好的CSS挑战:) – jlmakes 2011-01-26 22:26:48