WikiPediaのような2コラムの最小構成

WikiPediaのような
  • サイドバー幅固定
  • メインコラム幅動的

なレイアウトの最小構成。WikiPediaのコードを削って検証。

<?xml version="1.0" encoding="utf-8"?>
<!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" xml:lang="ja" lang="ja" dir="ltr">
<head>
<title>テスト</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css" media="screen" ><!--
body, #container {
 margin: 0px;
 padding: 0px;
}
#container, #main_column {
 width: 100%;
}
body {
 background: rgb(249, 249, 249);
 color: black;
}
#main_column {
 padding: 0px;
 float: right;
 margin: 2.5em 0px 0.6em -12em;
 border-width: 1px 0 1px 1px;
 border-color: green;
}
#sub_column {
 padding-top: 160px;
 border-width: 1px 0 1px 1px;
 border-color: blue;
}
#content {
 position: relative;
 background: white;
 border-width: 1px 0 1px 1px;
 border-color: red;
 margin-left: 12em;
 z-index: 2;
}
#footer {
 clear: both;
 border-width: 1px 0 1px 1px;
 border-color: black;
}
#column_content, #column-one, #footer, #content {
 border-style: solid;
}
#logo {
 margin: 0;
 top: 0px;
 left: 0px;
}
#logo, #header, #meta {
 font-size: 100%;
 position: absolute;
 z-index: 1;
}
#header {
 margin-left: 12em;
 left: 0px;
 top: 0px;
 z-index: 1;
}
#meta {
 float: right;
 left: auto;
 right: 0px;
 top: 0em;
}
#meta li {
 float: right;
 list-style: none;
 padding: 0 1em;
 margin: 0 0.5em 1em;
 border: 1px solid #666;
 background: #ddd;
}
-->
</style>
</head>
<body >
 <div id="container">
 <div id="main_column">
 <div id="content">
 <h1 >ページタイトル</h1>
 <h2 >見出し2</h2>
 <p>
 <img width="320" height="240" class="inParagraph" style="float:left; margin:0.5em" />
 </p>
 <p>
 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 </p>
 <p>
 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 </p>
 </div><!-- end #content -->
 </div><!-- end #main_column -->

 <div id="sub_column" >
 <div id="navigation" >
 <h2>ナビゲーション</h2>
 <ul>
 <li>項目1</li>
 <li>項目2</li>
 <li>項目3</li>
 <li>:</li>
 </ul>
 </div>
 <div id="header" >ヘッダー</div>
 <div id="logo" ><img alt="ロゴ" width="150" height="120" /></div>
 <div id="meta" >
 <ul>
 <li>管理</li>
 <li>ログイン</li>
 <li>編集</li>
 </ul>
 </div>
 </div>

 <div id="footer" >フッターです。</div>

 </div><!-- END OF #container -->
</body>
</html>

Leave a Reply