現在地: Home » 初級ホームページ作成講座:目次 » 速習CSSレイアウト解説:float3カラム

CSS
#wrapper{
padding:0px;
margin:0px auto;
width:800px;
}
HTML
<div id="wrapper"></div>
上記指定が完了したら、HTMLの<div id="wrapper"></div>の中にボックス【div】を5つ入力します。
<div id="wrapper"> <div></div> <div></div> <div></div> <div></div> <div></div> </div>++++++++++wrapperの終り
CSS
#header{
padding:0px;
margin:0px;
height:150px;++++++++++高さのみ指定
}
HTML
<div id="wrapper"> <div id="header"> </div> <div></div> <div></div> <div></div> <div></div> </div>++++++++++wrapperの終り

CSS
#left_sidebar{
padding:0px;
margin:0px;
width:180px;
float:left;++++++++++左へ配置
}
HTML
<div id="wrapper"> <div id="header"> </div> <div id="left_sidebar"> </div> <div></div> <div></div> <div></div> </div>++++++++++wrapperの終り

CSS
#contents{
padding:0px;
margin:0px;
width:440px;
float:left;++++++++++#left_sidebarの隣に配置
}
HTML
<div id="wrapper"> <div id="header"> </div> <div id="left_sidebar"> </div> <div id="contents"> </div> <div></div> <div></div> </div>++++++++++wrapperの終り

CSS
#right_sidebar{
padding:0px;
margin:0px;
width:180px;
float:left;++++++++++#contentsの隣に配置
}
HTML
<div id="wrapper"> <div id="header"> </div> <div id="left_sidebar"> </div> <div id="contents"> </div> <div id="right_sidebar"> </div> <div></div> </div>++++++++++wrapperの終り

CSS
#footer{
padding:0px;
margin:0px;
text-align:center;
clear:both;
}
HTML
<div id="wrapper"> <div id="header"> </div> <div id="left_sidebar"> </div> <div id="contents"> </div> <div id="right_sidebar"> </div> <div id="footer"> </div> </div>++++++++++wrapperの終り

以上で完成です。