css div 布局(左右固定,中間自動大小)

來源:互聯網
上載者:User

<!DOCTYPE html><html lang="zh">        <head>        <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />        <meta name="viewport" content="width=device-width" />        <title>布局</title>        <script src="http://code.jquery.com/jquery-latest.js"></script>        <style type="text/css">            body {                font-family: Verdana, Arial;                margin: 0;                font-size: 12px;            }                        div {                background-color: #eee;                border: dotted 1px green;                text-align:center;            }            #dyleft {                float: left;                width: 200px;                height:200px;                margin-left:20px;                line-height:200px;            }            #dycenter {                margin: 0 210px;                height:200px;                line-height:200px;            }            #dyright {                float: right;                height:200px;                line-height:200px;                width: 200px;                margin-right:20px;            }        </style>    </head>        <body>        <div id="mainbody">            <div id="dyleft">div左欄固定寬度為200px</div>            <div id="dyright">div右欄固定寬度為200px</div>            <div id="dycenter">div中間自適應寬度</div>        </div>    </body></html>

注意:mainbody中的div順序是左、右、中;顛倒之後害死人阿

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.