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.