ÎÒ×îϲ»¶µÄÊÇ·½·¨Èý£¬È±µã²»¶à¡£ÒòΪ content »áÇå³ý¸¡¶¯£¬ËùÒÔ¿ÉÒÔÔÚËüÉÏÃæ·ÅÖñðµÄÔªËØ£¬²¢ÇÒµ±´°¿ÚËõ·Åʱ£¬
¾ÓÖÐµÄ content ²»»á°ÑÁíÍâµÄÔªËظÇס¡£
<div id="top">
<h1>Title</h1>
</div>
<div id="content">
Content Here</div>
#floater {float:left; height:50%; margin-bottom:-120px;}
#top {float:right; width:100%; text-align:center;}
#content {clear:both; height:240px; position:relative;}
ÏÖÔÚÄãÖªµÀÊÇÔõô»ØÊÂÁË£¬ÏÖÔÚÎÒÃÇ¿ªÊ¼´´½¨Ò»¸ö¼òµ¥µ«ÊÇÓÐȤµÄÍøÕ¾¡£×îÖÕµÄÑù×ÓÊÇÕâÑùµÄ£º
²½ÖèÒ»
ÒÔÓïÒ廯±êÇ©¿ªÊ¼ÊǺܺõġ£ÏÂÃæÊÇÎÒÃǵÄÒ³Ãæ¹¹³É£º
#floater/*°Ñ content ÖÃÖÐ*/
#contred/*centre ºÐ*/
#side
#logo
#nav/*ÎÞÐòÁбí*/
#content
#bottom/*·ÅÖðæȨµÈ*/
ÕâÊÇÎÒÓõ½µÄ xhtml ´úÂ룺
A Centred Company
<div id="centered">
<div id="side">
<div id="logo">
<strong><span>A</span> Company</strong></div>
<ul id="nav">
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">About</a></li>
</ul>
</div>
<div id="content">
<h1>Page Title</h1>
Holisticly re-engineer value-added outsourcing after process-centric collaboration and idea-sharing.
Energistically simplify impactful niche markets via enabled imperatives.
Holisticly predominate premium innovation after compelling scenarios.
Seamlessly recaptiualize high standards in human capital with leading-edge manufactured products.
Distinctively syndicate standards compliant schemas before robust vortals.
Uniquely recaptiualize leveraged web-readiness vis-a-vis out-of-the-box information.
<h2>Heading 2</h2>
Efficiently embrace customized web-readiness rather than customer directed processes.
Assertively grow cross-platform imperatives vis-a-vis proactive technologies.
Conveniently empower multidisciplinary meta-services without enterprise-wide interfaces.
Conveniently streamline competitive strategic theme areas with focused e-markets.
Phosfluorescently syndicate world-class communities vis-a-vis value-added markets.
Appropriately reinvent holistic services before robust e-services.</div>
</div>
<div id="bottom">
Copyright notice goes here</div>
²½Öè¶þ£º
ÏÖÔÚÎÒÃÇ¿ªÊ¼ÓÃһЩ»ù±¾µÄ CSS À´¸øÒ³ÃæÌí¼ÓÑùʽ¡£°ÑÒÔÏ´úÂë·ÅÈëÔÚÎÒÃÇµÄ html Ò³Ã涥²¿±»ÒýÈëµÄ style.css¡£
html, body {
margin:0; padding:0;
height:100%;
}
body {
background:url('page_bg.jpg') 50% 50% no-repeat #FC3;
font-family:Georgia, Times, serifs;
}
#floater {
position:relative; float:left;
height:50%; margin-bottom:-200px;
width:1px;
}
#centered {
position:relative; clear:left;
height:400px; width:80%; max-width:800px; min-width:400px;
margin:0 auto;
background:#fff;
border:4px solid #666;
}
#bottom {
position:absolute;
bottom:0; right:0;
}
#nav {
position:absolute; left:0; top:0; bottom:0; right:70%;
padding:20px; margin:10px;
}
#content {
position:absolute; left:30%; right:0; top:0; bottom:0;
overflow:auto; height:340px;
padding:20px; margin:10px;
}
ÔÚÎÒÃÇÄܹ»°Ñ content ´¹Ö±¾ÓÖÐ֮ǰ£¬ body ºÍ html Ó¦¸Ã±»ÀÉìµ½ 100£¥ µÄ¸ß¶È¡£ÓÉÓÚ height
ÔÚ padding ºÍ margin Ö®ÄÚ£¬ËùÒÔÎÒÃÇÒª°ÑËüÃÇÉè³É 0 ÒÔ·ÀÖ¹ÒòΪºÜСµÄ margin ³öÏÖ¹ö¶¯Ìõ¡£
floater µÄ margin-bottom ÊÇ content ¸ß¶È(400px)µÄÒ»°ë£¬ -200px¡£
ÏÖÔÚ¿ÉÒÔ¿´µ½Ò»ÏÂЧ¹û£º
#centred µÄ¿í¶ÈΪ 80£¥¡£Õâ¿ÉÒÔÊÐÍøÒ³Ëæ×ÅÏÔʾÆ÷µÄ´óС¶ø±ä»¯¡£Ò»°ã³Æ×÷Á÷Ìå²¼¾Ö¡£ÉèÖà min-width ºÍ
max-width ÒÔ±ÜÃâÍøÒ³¹ý´ó»òÕß¹ýС¡£ µ«ÊÇ IE ²»Ö§³Ö min/max-width¡£ÏÔÈ»¿ÉÒÔÓù̶¨¿í¶ÈÀ´´úÌæ¡£
ÒòΪ #centred ÊÇÏà¶Ô¶¨Î»µÄ£¬ÔÚËüÀïÃæÎÒÃÇ¿ÉÒÔÓþø¶Ô¶¨Î»À´¶¨Î»ÔªËØ¡£ÉèÖà #content µÄ overflow:auto;
ÒÔ±ÜÃâ¹ö¶¯ÌõµÄ³öÏÖ¡£IE ²»Ôõôϲ»¶ overflow:auto; ³ý·ÇÎÒÃÇÖ¸¶¨¸ß¶È(²»ÊÇ top ºÍ bottom µÄ¶¨Î»£¬Ò²²»ÊÇ £¥)
Òò´ËÎÒÃǸøËüÖ¸¶¨¸ß¶È¡£
²½ÖèÈý
×îºóÒª×öµÄ¾ÍÊÇÔÙÌí¼ÓµãÑùʽ£¬ÈÃÒ³ÃæºÃ¿´µã¡£´ÓĿ¼¿ªÊ¼°É¡£
#nav ul {
list-style:none;
padding:0; margin:20px 0 0 0; text-indent:0;
}
#nav li {
padding:0; margin:3px;
}
#nav li a {
display:block; background-color:#e8e8e8;
padding:7px; margin:0;
text-decoration:none; color:#000;
border-bottom:1px solid #bbb;
text-align:right;
}
#nav li a::after {
content:'»'; color:#aaa; font-weight:bold;
display:inline; float:right;
margin:0 2px 0 5px;
}
#nav li a:hover, #nav li a:focus {
background:#f8f8f8;
border-bottom-color:#777;
}
#nav li a:hover::after {
margin:0 0 0 7px; color:#f93;
}
#nav li a:active {
padding:8px 7px 6px 7px;
}
ÐèҪעÒâµÄÊÇ #centred µÄÔ²½Ç¡£ CSS3 ÖУ¬Ó¦¸ÃÓÐ border-radius ÊôÐÔÀ´É趨Բ½ÇµÄ°ë¾¶¡£ÏÖÔÚµÄ
Á÷ÐеÄä¯ÀÀÆ÷¶¼»¹²»Ö§³Ö£¬³ý·ÇÓà -moz(Molilla Firefox) »òÕß -webit(Safari/Webkit) ǰ׺.
¼æÈÝÐÔ×¢ÒâÊÂÏî
ÈçÄãËùÏ룬IE ÊÇΨһÌíÂé·³µÄä¯ÀÀÆ÷¡£
#floater ±ØÐëÖ¸¶¨¿í¶È£¬·ñÔòÔÚÈÎÒâ°æ±¾ IE ÖУ¬Ëü¶¼É¶Ò²²»¸É
IE 6 ÖÐĿ¼±»ÖÜΧ̫¶àµÄ¿Õ¼ä´ò¶Ï
IE 8 ÓжàÓà¿Õ¼ä(×÷ÕßÒÅ©)
¸ü¶àµÄÏë·¨
ÀûÓþÓÖеÄÍøÒ³¿ÉÒÔ×öºÜ¶àÓÐÒâ˼µÄÊÂÇé¡£ÎÒÔÚÖØÐÂÉè¼Æ SWFObject Generator 2.0 (ʹÓà SWFObject2.0 Éú³É´úÂë)ʹÓÃÁËÕâ¸öÏë·¨¡£ÕâÀïÓÐÁíÍâµÄÒ»¸öÏë·¨¡£