WEB标准时页面自适应的解决方案_[Html教程]
很多时候明明感觉应该自适应的效果,可是在不同浏览器里却取得不同的结果,这个时候最令人伤神。
XHTML Untitled Document?
?
?
?
?
?
Header content goes here
?
Left column Longest
?
Right column Longest
?
No column longest
?
Back to main
? 3 column demo
?
?
?
Navigation
?
?
?
Sidebar content goes here : Sidebar content goes here : Sidebar content
? goes here : Sidebar content goes here : Sidebar content goes here : Sidebar
? content goes here : Sidebar content goes here : Sidebar content goes here
? : Sidebar content goes here : Sidebar content goes here : Sidebar content
? goes here : Sidebar content goes here :
?
?
?
Footer stays at the bottom of the window unless the content is longer then
? it stays at the bottom of the document.
?
Footer stays at the bottom of the window unless the content is longer then
? it stays at the bottom of the document.
?
?
?
?
?
?
?
?
Footer Content
?
CSS /* commented backslash hack v2 \*/
html, body{height:100%;}
/* end hack */
html,body {
margin: 0;
padding: 0;
}
body {
font: x-small arial, hevetica, sans-serif;
text-align: center;
color: #505367;
background-color: #e0e0e0;
}
#container {
margin-left:auto;
margin-right:auto;
width: 730px;
min-height:100%;
text-align: left;
background: #CEE0E1 url(images/toddbg.gif) repeat-y right top;
border-left: 1px solid #a1a1a1;
border-right: 1px solid #a1a1a1;
? position:relative;
}
/* commented backslash hack v2 \*/
* html #container {height:100%;}
* html #container {width:732px;w\idth:730px;}
* html body{font-size:xx-small;f\ont-size:x-small}
/* end hack */
#mainheader {
position:absolute;
left:0;top:0;
height: 160px;
width:100%;
background-color: #fff;
border-bottom: 1px solid #e6e6e6;
z-index:1;
}
#header {
height: 125px;
width:100%;
background-color: #D1DCE9;
margin: 0px 0px 5px 0px;
border-top: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
position:relative;
z-index:2;
overflow:hidden;
}
* html #mainheader {height:161px;he\ight:160px}
* html #header {height:127px;he\ight:127px}
#mainnav {
width:100%;
height: 20px;
background-color: #f5f5f5;
border-top: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
position:relative;
z-index:2;
}
* html #mainnav{height:22px;he\ight:20px}
#sidebar {
float: right;
width: 170px;
padding:5px 0 ;
}
#content {
width: 553px;
padding:5px 0 ;
}
#content p, #sidebar p, #mainnav p, #header p,#footer p {margin:0 5px 5px 5px}
#footer{
position:absolute;
bottom:0;
width:100%;
height: 24px;
background-color: #f5f5f5;
border-top: 1px solid #e9e9e9;
}
#footer p {margin:0;padding:0}
* html #footer {height:25px;he\ight:24px;}
.divider1 {
width:100%;
height:5px;
overflow:hidden;
background:#fff;
position:relative;
border-bottom: 1px solid #e6e6e6;
}
#clearfooter {height:27px;width:100%;clear:both}
.blank , .blank2 {
position:absolute;
left:547px;
width:7px;
height:0px;
overflow:hidden;
border-top:1px solid #fff;
}
.blank {top:-1px;}
.blank2 {bottom:-1px;border-top:1px solid #fff;
}
效果参照:
http://www.pmob.co.uk/temp/2col_main.htm