CSS-three rows, three columns, and high-level pattern.
(05:23:42)
ReprintedBytes
Miscellaneous
Step 1: create a structure
XHTML starts with header, footer, and container
<Div id = "Header"> </div>
<Div id = "Container"> </div>
<Div id = "footer"> </div>
CSS first defines the container and leaves a position for the added sideleft and sideright.
# Container {
Padding-left: 200px;
Padding-Right: 150px;
}
Our current pattern looks like this
Figure 1-create a framework
Step 2: add content elements
Add the content element <Div id = "Header"> </div>
<Div id = "Container">
<Div id = "center" class = "column"> </div>
<Div id = "Left" class = "column"> </div>
<Div id = "right" class = "column"> </div>
</Div>
<Div id = "footer"> </div>
Then define widths and float to orchestrate elements on the same line, and clean footer's fl and alignment.
# Container. Column {
Float: left;
}
# Center {
Width: 100%;
}
# Left {
Width: 200px;
}
# Right {
Width: 150px;
}
# Footer {
Clear: both;
}
The 100% width is defined for the center element to fill the available space of montainer.
Figure 2: add content elements
Step 3: place left in the correct position
To place left in the correct position, we will take two steps.
1. Align left and center # Left {
Width: 200px;
Margin-left:-100%;
}
See what you get
Figure 3 -- left move ends in half
2. Use relative positioning to move left to the correct position # container. Columns {
Float: left;
Position: relative;
}
# Left {
Width: 200px;
Margin-left:-100%;
Right: 200px;
}
After left is px from the center on the right, the line is displayed, and left is at its position.
Figure 4 -- left to its position
Step 4: Let the right be in its correct position
From the perspective, we only need to push right into the padding-right of the container, cowww.freety1.info.countingsheepboutique.com, to see how to do it.
# Right {
Width: 150px;
Margin-Right:-150px;
}
Now, all the elements are accurate.
Figure 5-Right: accurate position
Step 5: handle bugs to improve the pattern
In case the window size of the Expo server changes, the center will become smaller than left, and the sound structure will be broken through. We will set a min-width for the body.
To solve this problem, because IE does not support him, so there will be no negative impact, the swap is as follows
Body {
Min-width: 550px;
}
At this time, in IE6 (a fully open window), the left element is informative and the left side is too far away, and then adjust
* Html # Left {
Left: 150px;
}
The size adjustment is based on the width defined above. You should also adjust the size according to your actual situation.
Currently, padding is added.
The content and text are appended to the container's edge. If it is credible, it won't be very comfortable for you. Just adjust it.
# Left {
Width: 180px;
Padding: 0 10px;
Right: 200px;
Margin-left:-100%;
}
Of course, you can't just add left. Even if you're done, you have to add a series of elements and adjust the padding. The new bug is introduced as follows:
Body {
Min-width: 630px;
}
# Container {
Padding-left: 200px;
Padding-Right: pixel PX;
}
# Container. Column {
Position: relative;
Float: left;
}
# Center {
Padding: 10px 20px;
Width: 100%;
}
# Left {
Width: 180px;
Padding: 0 10px;
Right: 240px;
Margin-left:-100%;
}
# Right {
Width: 130px;
Padding: 0 10px;
Margin-Right:-pixel PX;
}
# Footer {
Clear: both;
}
* Html # Left {
Left: 150px;
} The header and footer padding can be easily added, so we won't mention it here, and the length unit is more friendly with EM (EM allows users to adjust their necessary font size using the Expo server)
However, it cannot be used together. it is wise to choose em and PX to check the harvest.
Element and other issues
Approve OM/Tech/web/2006/3210 .asp
The measures mentioned in are not detailed.
# Container {
Overflow: hidden;
}
# Container. Column {
Padding-bottom: 20010px;
Margin-bottom:-20000px;
}
# Footer {
Position: relative;
}
Handle the bug of opera 8 again. The code is adjusted as follows:
<Div id = "footer-wrapper">
<Div id = "footer"> </div>
</Div> * html body {
Overflow: hidden;
}
* Html # footer-wrapper {
Float: left;
Position: relative;
Width: 100%;
Padding-bottom: 10010px;
Margin-bottom:-pixel PX;
Background: # FFF;
} The entire process ends, looking at the final gains, and perceiving errors through the W3C validation model rather than the untargeted Expo code, the code review will get twice the result with half the effort.
Public Security three WebServices Terminal Test preparation questions.