温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

HTML布局

发布时间:2020-07-17 15:50:42 来源:网络 阅读:411 作者:yeleven 栏目:开发技术

一、使用<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问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI