首页 » 记事本 » CSS 2列百分比定位

CSS 2列百分比定位

优先加载内容区

<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8" />
    <title>布局</title>
    <style>
        .demo {
            overflow: hidden;
            width: 1000px;
            height: 600px;
            padding: 10px;
            margin: 0 auto;
            background: #f9f9f9;
        }

        .columns {
            height: 100%;
            width: 100%;
            right: 74%;
            position: relative;
        }

        .main {
            width: 74%;
            min-height: 100%;
            position: relative;
            left: 100%;
            background: #ddd;
            float: left;
        }

        .sidebar {
            width: 25%;
            min-height: 100%;
            float: left;
            overflow: hidden;
            background: #ccc;
        }
    </style>
</head>
</head>

<body>
<div class="demo">
    <div class="columns">
        <div class="main">main</div>
        <div class="sidebar">sidebar</div>
    </div>
</div>

</body>

</html>
此文章发表在 记事本. 将 固定链接 加入收藏.