CSS Position Elastic box test

Source: Internet
Author: User

Summarize:

1. Use style height:100% set div height to full screen when all the parent elements must be set, but the parent element is so many, not controllable, so this method is not feasible;

2. The padding of the parent frame is float,padding valid for 100px,div, but the DIV is position, and the left:0,padding fails;

3. The elastic box model requires a position attribute and two relative properties, such as top and bottom,left and right.

4. To make three modules from the adaptation, calculate the left and right values for the middle Div after position, which is related to the div widths on both sides of the

The code for the test is as follows:

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "Utf-8" />        <title></title>        <styletype= "Text/css">        *{padding:0;margin:0;                    }        /*html,body{height:100%; }*/. Elasticitybox{Border:1px #000 Solid;padding:100px;        }. Elasticitybox. box01{position:Absolute;Border:1px Red Solid;Top:0;Bottom:0; Left:200px; Right:200px;        }        /*. Elasticitybox. box01{border:1px Red Solid;        Float:left; }*/. Elasticitybox. box02{Border:1px yellowgreen Solid;width:100px;position:Absolute; Left:0;Top:0;Bottom:0;        }. Elasticitybox. box03{Border:1px yellowgreen Solid;width:100px;position:Absolute; Right:0;Top:0;Bottom:0;        }        </style>    </Head>    <Body>        <Divclass= "Elasticitybox">            <Divclass= "box01">123</Div>            <Divclass= "box02">3456</Div>            <Divclass= "box03">789</Div>        </Div>    </Body></HTML>

CSS Position Elastic box test

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.