Div highly adaptive

Source: Internet
Author: User

Today, I handled a problem of Div height self-adaptation... record...

The effect is that head and foot are fixed, and the content DIV in the middle is highly adaptive...

 <!  Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"  >      <  Html  Xmlns  = "Http://www.w3.org/1999/xhtml"  Lang  = "ZH-CN"  >      <  Head  >     <  Title  > </  Title  >      <  Style  Type  = "Text/CSS"  >  HTML, body  {  Margin  :  0 ;  Padding  :  0  ;          }      </  Style  >      </  Head  >      <  Body  >         <  Div  Style  = "Height: 100px; position: fixed; width: 400px; Background-color: Gray; top: 0 ;"  > <  H1  > This is top </  H1  > </  Div  >           <  Div  Style = "Float: Left; width: 400px; position: absolute; overflow-Y: Scroll; overflow-X: hidden; Background-color: green; top: 100px; bottom: 100px ;"  >                   <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  /> Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  < BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  /> Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  < BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  /> Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  < BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa <  BR  />  Aaaaaaaaaaaaaaaaaaaa  <  BR  />  Aaaaaaaaaaaaaaaaaaaa  </  Div  >          <  Div  Style  = "Height: 100px; position: fixed; width: 400px; Background-color: Gray; bottom: 0 ;" > <  H1  > This is bottom </  H1  > </  Div  >      </  Body  >      </  Html  >   

The effect is that the content div is highly adaptive.

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.