溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

HTML布局

發(fā)布時間:2020-07-17 15:50:42 來源:網絡 閱讀:411 作者:yeleven 欄目:開發(fā)技術

一、使用<div>元素布局

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>div布局</title>
    <style type="text/css">
        body{
            margin:0px;
        }
        #container{
            width:100%;
            height:950px;
            background-color:darkgray;
        }
        #heading{
            width:100%;
            height:10%;
            background-color:aqua;
        }
        #content_menu{
            width:30%;
            height:80%;
            background-color:aquamarine;
            float:left;
        }
        #content_body{
            width:70%;
            height:80%;
            background-color:blueviolet;
            float:left;
        }
        #footing{
            width: 100%;
            height: 10%;
            background-color: black;
            clear: both;
        }
    </style>
</head>
<body>
    <div id="container">
        <div id="heading">頭部</div>
        <div id="content_menu">內容菜單</div>
        <div id="content_body">內容主體</div>
        <div id="footing">底部</div>

    </div>
</body>
</html>


二、使用<table>元素布局

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>table布局</title>
    <style type="text/css">
        body{
            margin:0px;
        }
        #container{
            width:100%;
            height:950px;
            background-color:darkgray;
        }
        #heading{
            width:100%;
            height:10%;
            background-color:aqua;
        }
        #content_menu{
            width:30%;
            height:80%;
            background-color:aquamarine;
            float:left;
        }
        #content_body{
            width:70%;
            height:80%;
            background-color:blueviolet;
            float:left;
        }
        #footing{
            width: 100%;
            height: 10%;
            background-color: black;
            clear: both;
        }
    </style>
</head>
<body>
    <table width="100%" height="950px" >
        <tr>
            <td colspan="2" width="100%" height="10%" >這是頭部</td>
        </tr>
        <tr>
            <td width="30%" height="80%" >左菜單</td>
            <td width="70%" height="80%" >主體</td>
        </tr>
        <tr>
            <td width="100%" height="10%" colspan="2" >這是底部</td>
        </tr>
    </table>
</body>
</html>



向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI