Left fixed width, right adaptive width CSS Layout _ Experience Exchange

Source: Internet
Author: User
There are experts in bi who specifically discuss this layout method, but he used more hack, but also avoided the IE6 DTD. In my actual use, I found that avoiding the DTD definition of IE6 will cause the Ajax modal box to not be centered (a control of VS, automatically generated code, which is difficult to modify). So I wrote a simple left and right two-column layout, useless to what hack, very simple, just practiced hand use.

CSS code: Left and right are all stuck to the right. Set left on right (Z-index), in the right Nega layer (content), set contents distance to the right of 200px, that is, the width is equal to leave.
Copy CodeThe code is as follows:
* {margin:0; padding:0; list-style:none;}
. wrapper {width:100%;}
. Left {width:200px;background: #fcc; position:absolute; left:0; Z-index:1}
. Right {width:100%;background: #ccc; position:absolute;left:0}
. Content {margin-left:200px;background: #ffc;}

Full code
<textarea id="runcode43424"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < HTML xmlns= "http://www.w3.org/1999/xhtml" > <pead> <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/> <title></title> <style type=" Text/css "> * {margin:0; padding:0; list-style:none ; }. wrapper {width:100%;}. Left {width:200px; background: #fcc; position:absolute; left:0; Z-index:1}. Right {width:100%; background: #ccc; position:absolute; left:0}. Content {margin-left:200px; background:# Ffc } </style> </pead> <body> left fixed width 200px right width auto fit </body> </ptml></textarea>
[Ctrl + A full selection Note: If you need to introduce external JS need to refresh to execute]
  • Related Article

    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.