CSS experience sharing 2. Two-column layout example

Source: Internet
Author: User

See the figure first. Here we mainly use the float attribute. The value of this attribute indicates whether or not the object is floating.

Parameters:None:Objects do not float;Left:Objects float on the left;Right:Object floating on the right

Please refer to the code. Please advise CSS experts. You can also use position to implement two columns.Float.

<! 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">
<Title> classic layout </title>
<Style type = "text/CSS">
/* General Blank spacing */
. Blank9 {Height: 9px; width: 100% ;}

# Wrap {width: 960px; margin: 0 auto ;}
# Header
Height: 80px;
Margin: 0 auto;
Clear: both;
Border: # cccccc 1px solid;
/* Left */
# Sideleft
Height: 120px;
Float: left;
Width: 200px;
Overflow: hidden;
Border: # cccccc 1px solid;

/* Right */
# Sideright
Height: 120px;
Float: right;
Width: 750px;
Overflow: hidden;
Background-color: # fcf8f7;
Border: # cccccc 1px solid;

/* End of the page */
# Footer {Height: 50px; Border: # cccccc 1px solid; margin: 0 auto ;}


<Div id = "Wrap">
<Div id = "Header">

<A name = "TOP"> </a>

<Span> page header </span>

<Div class = "blank9"> </div>
<Div id = "sideleft">
<Span> left </span>
<Div id = "sideright">

<Span> right </span>

<Div class = "blank9"> </div>
<Div id = "footer">
<Div id = "foot">
<Span> footer </span>



Read more: CSS + Div layout Summary-BasicsDiv LayoutI made a good summary and read the values for all beginners.

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.