%19 左侧部分宽度,%80 内容宽度:

alt text

但我想将左侧部分固定为 200px,内容部分是可视区域宽度的其余部分。

我怎样才能用 CSS 做到这一点?

<html>
<head>
    <title>TWO-COLUMN LIQUID LAYOUT WITH FLOATING BOXES</title>
    <style type="text/css">
        body
        {
            margin: 0px;
            padding: 0px;
        }
        div
        {
            border: 1px solid black;
        }
        #header
        {
            background: #0f0;
            width: 100%;
        }
        #leftcol
        {
            background: #f00;
            float: left;
            width:19%;
            /* max-width: 200px; */ 
            height: 500px;
        }
        #content
        {
            background: #fff;
            float: left;
            width: 80%;
            height: 500px;
        }
        #footer
        {
            background: #0f0;
            clear: both;
            width: 100%;
        }
    </style>
</head>
<body>
    <div id="header">
        Header Section</div>
    <div id="leftcol">
        Left Section</div>
    <div id="content">
        Content Section</div>
    <div id="footer">
        Footer Section</div>
</body>
</html>
有帮助吗?

解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top