Div CSS left fixed right adaptive layout

Source: Internet
Author: User

Web front-end development layout: first look, the simplest left and right Layout. may also be asked by the interview Hahaha. See also nothing special, is fixed on the left, the right self-adaptation, so Simple.

Principle: by setting a margin-left, or margin-right can be done. There are many ways to do this, and this time only introduces this set of Margin.

Code:

<!doctype html><html> <head>  <metacharset="UTF-8">  <title>Document</title>    <style>    body{        margin:0;        padding:0;    }           #wrap {            overflow: hidden; *zoom: 1;        }        #content ,#sidebar {            #eee;         }        #sidebar {            float: left; width: 300px;            background-color:pink;            position:fixed;            top:50px;            left:0;        }        #content {            margin-left: 310px;            height:1000px;            background-color:#e456aa;            margin-top:50px;        }        #footer {            background-color: #f00;            color:#fff;             margin-top: 1em;        }    </style> </head> <body>    <divstyle="width:100%;height:50px;line-height:50px;background-color:#ccc;position:fixed;top:0;left:0;">这是头部:web前端开发大全</div>    <divid="wrap">        <divid="sidebar"style="height:600px;">固定宽度区:号:jingfeng18</div>        <divid="content"style="height:1340px;">自适应区</div>    </div>    <divid="footer">这是尾部,想写什么就写什么,这是一个神奇的地方</div> </body>    </html>

Very simple, If you have a better way, welcome to come to the exchange of Contributions. Only for learning more, technology to a higher level, an early rise in salary, win white Rich beauty, embark on the pinnacle of Life. Learn more front-end technology is in: Web front-end development View Daquan

Please remember our website: http://www.qianduanshiping.com no.: jingfeng18

Div CSS left fixed right adaptive layout

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.