Fixed floating layout of Div + CSS layout

Source: Internet
Author: User

Fixedfloat.htm

<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"
Http://www.w3.org/TR/html4/loose.dtd>
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> fixed floating Layout-three columns </title>
<LINK rel = "stylesheet" style = "text/CSS" href = "style2.css">
</Head>

<Body>
<Div id = "Header"> <Div id = "body">
<Div id = "navl"> left navigation </div>
<Div id = "Main"> content </div>
<Div id = "navr"> right navigation </div>
</Div>
<Div id = "footer"> <p> copyright </P> </div>
</Body>
</Html>

Style.css

/* CSS document */
*{
Margin: 0;
Padding: 0;
}
Body {
Margin: 10px;
}
# Header {
Border: 1px solid black;
Width: 600px;
Height: 60px;
Margin: 0 auto;
Margin-bottom: 10px;
}
# Header H1 {
Height: 60px;
Line-Height: 60px;
Font-size: 16px;
Text-align: center;
}
# Body {
Width: 600px;
Margin: 0 auto;
}
# Navl {
Border: 1px solid black;
Width: 150px;
Height: 500px;
Float: left;
Margin-bottom: 10px;
Background: lightcyan;
}
# Main {
Border: 1px solid black;
Width: 294px;/* The border is also a pixel */
Height: 500px;
Float: left;
Margin-bottom: 10px;
Background: lightblue;
}
# Navr {
Border: 1px solid black;
Width: 150px;
Height: 500px;
Float: right;
Margin-bottom: 10px;
Background: lightyellow;
}
# Footer {
Border: 1px solid black;
Width: 600px;
Height: 60px;
Line-Height: 60px;
Margin: 0 auto;
Text-align: center;
Clear: both;
}

The effect is as follows:

The advantage of this layout is that the width and height of the DIV are fixed, and all changes to the size of the browser window do not affect the display of the div.

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.