10-Day Learning Div+css (Div layout)

Source: Internet
Author: User

A list of layouts:

One column fixed width, one column fixed width centered, one column adaptive width, one column adaptive width center

Fixed width of a column

<style type= "Text/css" >

#layout {height:300px; width:400px; background: #99FFcc;}
</style>

One column fixed width centered

<style type= "Text/css" >

#layout {height:300px; width:400px; background: #99FFcc; margin:auto;}

</style>

A column of adaptive widths

<style type= "Text/css" >

#layout {height:300px; background: #99FFcc;}

</style>

A column of adaptive width centering

<style type= "Text/css" >

body {margin:0px;}
#layout {margin:auto; height:300px; background: #99FFcc; width:80%;}

</style>

Two-Column layout

Two-column adaptive width, two-column fixed-width, one-column fixed-width centering, and float properties.

Two-Column adaptive width


<style type= "Text/css" >
#side {background: #99FF99; height:300px; width:120px; float:left;}
#main {background: #99FFFF; height:300px; width:70%; margin-left:120px;}
</style>

Two-column fixed width


<style type= "Text/css" >
#side {background: #99FF99; height:300px; width:120px; float:left;}
#main {background: #99FFFF; height:300px; width:350px; margin-left:120px;}
</style>

Two-column fixed-width centering


<style type= "Text/css" >
#content {width:470px; margin:0 auto;}
#side {background: #99FF99; height:300px; width:120px; float:left;}
#main {background: #99FFFF; height:300px; width:350px; margin-left:120px;}
</style>

Float Property

<style type= "Text/css" >

body {font-size:18px; line-height:200%;}
#side {float:left;width:202px;}

#main {margin-left:202px;}

</style>

Three-column layout

Three-column adaptive width, three-column fixed-width, three-column fixed-width center,

IE6 3-pixel bug

Three-column adaptive width

<style type= "Text/css" >
body {margin:0;}
#side {background: #99FF99; height:300px; width:120px; float:left;}
#side1 {background: #99FF99; height:300px; width:120px; float:right;}
#main {background: #99FFFF; height:300px; margin:0 120px; }
</style>
Three-column fixed width

<style>
body {margin:0;}
#content {width:470px; margin:0 auto;}
#side {background: #99FF99; height:300px; width:120px; float:left;}
#side1 {background: #99FF99; height:300px; width:120px; float:right;}
#main {background: #99FFFF; height:300px; margin:0 120px; }
</style>

Three-column fixed-width centering


<style>
body {margin:0;}
#content {width:470px; margin:0 auto;}
#side {background: #99FF99; height:300px; width:120px; float:left;}
#side1 {background: #99FF99; height:300px; width:120px; float:right;}
#main {background: #99FFFF; height:300px; margin:0 120px; }
</style>

10-Day Learning Div+css (Div 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.