Today, div + CSS is more and more popular with search engines and web designers, but it is also because a CSS file is too large, if you accidentally lose it, it will be a terrible webpage. Because of its convenient modification, we are always infatuated with it. I always want to create a software that can control Div layout very well, so that we can not write CSS. How good is it? Although there is, it has never been found, let's take a look at the layout of the following Div three rows and two columns.
<Body>
<Div id = "Header"> header </div>
<Div id = "contain">
<Div id = "mainbg">
<Div id = "right">
<Div class = "text"> content </div>
</Div>
<Div id = "Left">
<Div class = "text"> left </div>
</Div>
</Div>
</Div>
<Div id = "footer"> footer </div>
</Body>
The above basically completed three rows and two rows, starting with the content (left and right), footer layout, below we can adjust the CSS below, it is OK, save the following CSS as a separate CSS file. You can also use styles to write them in the same webpage, which is troublesome. If you want to use other webpages, it is not good. It is better to use them as an external file.
Body {
Text-align: center; color: #333; font-family: verdana,
Arial, Helvetica, sans-serif;
}
# Header {
Margin-Right: auto; margin-left: auto; padding: 0px; width: 776px; Height: 50 PX; text-align: left;
}
# Contain {
Margin-left: auto; margin-Right: auto; width: 776px;
}
# Mainbg {
Float: Left; padding: 0px; width: 776px; Background: #60a179;
}
# Right {
Float: Right; margin: 2px 0px 2px 0px; padding: 0px; width: 574px;
Background: # ccd2de; text-align: left;
}
# Left {
Float: Left; margin: 2px 2px 0px 0px; padding: 0px; Background: # f2f3f7;
Width: 200px; text-align: left;
}
# Footer {
Clear: Both; margin-Right: auto; margin-left: auto; padding: 0px; width:
776px; Background: # Eee; Height: 60px;
}
. Text {
Margin: 0px; padding: 20px;
}
In this way, the layout of a basic three-row and two-column structure is formed.