Small CSS experience: vertical, up/down height, adaptive in the middle

Source: Internet
Author: User

Today, I made a CSS style as required. In a DIV, the upper and lower heights are fixed and the middle is adaptive.

See the sample code below:

<Div id = container> <Div id = "TOP"> upper fixed height 100px </div> <Div id = "Middle"> central adaptive height </div> <Div ID = "bottom"> fixed bottom height 100px </div>

 

/* CSS file */# container {width: 100%; Height: 100%; position: relative;} # top {width: 100%; Height: 100px; position: absolute; top: 0; left: 0 ;}# middle {width: 100%; Height: 100px; position: absolute; // use absolute positioning to achieve adaptive top: 100px; bottom: 100px ;} # bottom {width: 100%; Height: 100px; position: absolute; bottom: 0; left: 0 ;}

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.