0

フロントページを中心に4つのコラムを作ろうとしています。次の例のようにしたいと思います:
http://www.clutterpad.com/

私のコードは次のようになります。

#bottom-container {width:100%;height:250px;position:relative;}
#bottom-mid {background-color:white;}
#bottom-left, #bottom-mid, #bottom-right {height:250px;}
#bottom-left, #bottom-right {width:50%;float:left;}

#bottom-left {background-color:white;position:absolute;top:0px;left:0px;}
#bottom-right {background-color:white;position:absolute;top:0px;left:50%;}

#bottom-mid {position:relative;margin:0px auto; width:1000px;z-index:2;}
#column-container {width:100%; margin:20px auto;}
.column {width:200px;float:left;font-size:10pt;font-family:Arial;margin:20px 10px;}

しかし、それはうまくいきません。前述の例のようにするには、どのようにコーディングすればよいでしょうか?

4

2 に答える 2

3

HTMLを含めることができれば良いのですが、私はこの問題に次のようにアプローチします:

<div id="fourcolumns">
    <div>Column</div>
    <div>Column</div>
    <div>Column</div>
    <div>Column</div>
</div>

CSS:

#fourcolumns {
    width: 100%;
    overflow: hidden;
}

#fourcolumns div {
    width: 25%;
    float: left;
}

列間にマージンを追加している場合、IE6 の double margin float バグの犠牲になります。#fourcolumns div { display: inline; }

于 2010-05-13T11:58:32.433 に答える
-1
<div id="fourcolumns"> 
    <div>Column</div> 
    <div>Column</div> 
    <div>Column</div> 
    <div>Column</div> 
</div> 

CSS:

#fourcolumns { 
    margin: 0 auto;
    width: 50%; 
    overflow: hidden; 
} 

#fourcolumns div { 
    width: 25%; 
    float: left; 
} 
于 2010-05-13T12:50:39.423 に答える