Home > Web Front-end > HTML Tutorial > CSS implements Holy Grail layout (two columns fixed - middle column floating - middle column div ranked in front) - Detailed explanation_html/css_WEB-ITnose

CSS implements Holy Grail layout (two columns fixed - middle column floating - middle column div ranked in front) - Detailed explanation_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:27:50
Original
1086 people have browsed it

Holy Grail layout: two columns fixed - middle column floating - middle column div ranked first. The advantage is that when the network speed is slow, the content column can be displayed first




< ;div id="left" class="column">



An additional DIV contains our three layers. This structure conforms to my focus on integrating the content into one tag. The custom
style is very simple. The left sidebar is 200PX and the right side is 150. For simplicity, LC, RC and CC represent the left, right and middle respectively. The style is as follows:

body {
min-width: 550px; /* 2x LC width RC width */
}
#container {
padding-left: 200px; /* LC width */
padding-right: 150px; / * RC width */
}
#container .column {
position: relative;
float: left;
}
#center {
width: 100%;
}
#left {
width: 200px; /* LC width */
right: 200px; /* LC width */
margin-left: -100%;
}
#right {
width: 150px; /* RC width */
margin-right: -150px; /* RC width */
}
#footer {
clear: both;
}
/*** IE6 Fix ***/
* html #left {
left: 150px; /* RC width */
}

Principle
In fact, the trick is very simple. Let the left column and the padding on the left side of the wrap, and the right column and the right padding of the wrap. Just leave the adaptive content layer in the middle. The left occupies the padding-left of the wrap; the right occupies the padding of the wrap. padding-right


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template