1. 程式人生 > >HTML CSS三欄佈局

HTML CSS三欄佈局

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        .header,.footer
        {
            width:100%;
            height:150px;
            background:#ff0;
            border:1px dashed #f00;
        }
        .container
        {
        	position: relative;
        	margin:0 auto;
            width:80%;
            height:500px;
            border:1px dashed #0f0;
            background:#ffd;
        }
        .sidebar
        {
        	position: relative;
            width:80%;
            background:orange;
            border:2px dotted inherit;
            float:right;
            height:100%;
        }
        .extraContent
        {
        	position: relative;
            float:left;
            width:15%;
            /*margin-left:-304px;*/
            background-color: red;
            height:100%;
        }
        .content
        {
            margin-left:504px;
            background:#dec;
            height:100%;
        }
    </style>
</head>
<body>
    <div class="header">
        標題
    </div>
    <div class="container">
        <div class="extraContent">
            <!-- <div id="content">
                內容
            </div> -->
        </div>
        <div class="sidebar">
            側邊欄
        </div>
    </div>
    <div class="footer">
        頁尾
    </div>
</body>
</html>