CSS ´¹Ö±¾ÓÖÐ
1.ͼƬµÄ´¹Ö±¾ÓÖÐ
.box
{
/*·ÇIEµÄÖ÷Á÷ä¯ÀÀÆ÷ʶ±ðµÄ´¹Ö±¾ÓÖеķ½·¨*/
display: table-cell;
vertical-align: middle; /*ÉèÖÃˮƽ¾ÓÖÐ*/
text-align: center;
/* Õë¶ÔIEµÄHack */
*display:block;
*font-size:175px;/*ԼΪ¸ß¶ÈµÄ0.873£¬200*0.873 ԼΪ175*/
*font-family:Arial;/*·ÀÖ¹·Çutf-8ÒýÆðµÄhackʧЧÎÊÌ⣬Èçgbk±àÂë*/
width:200px;
height:200px;
border:1px solid #eee;
}
.box img
{
/*ÉèÖÃͼƬ´¹Ö±¾ÓÖÐ*/
vertical-align: middle;
}
<div class="box">
<img src="http://pics.taobao.com/bao/album/promotion/taoscars_180x95_071112_sr.jpg" mce_src="http://pics.taobao.com/bao/album/promotion/taoscars_180x95_071112_sr.jpg" />
</div>
²Î¿¼ÎÄÕ£º
http://www.planabc.net/2008/05/26/img_vertical_center_solution/
http://www.student.oulu.fi/~laurirai/www/css/middle/
Ïà¹ØÎĵµ£º
ÔÚDIV+CSSµÄʱ´úÀӵÓÐÒ»¸öÌùÐĵÄCSSÊÖ²á»á¼«´óµÄÔö¼ÓÍøÒ³Éè¼ÆµÄЧÂÊ¡£Ä¿Ç°ÊÐÃæÉÏ´ó¼ÒÓõÄ×î¶àµÄ¾ÍÊÇËÕÉòСÓêÖÆ×÷µÄ¡¶CSS 2.0ÖÐÎÄÊֲᡷ£¬ÎÒÒ²Ò»Ö±ÓÃÁËÓÐËÄÎåÄêÁË¡£ÊÖ²áʹÓÃCHM¸ñʽ£¬ÄÚÈݷdz£µÄ·á¸»£¬¼¸ºõ°üÀ¨ÁËCSS2µÄËùÓÐÄÚÈÝ¡£
ÏÂÔØµØÖ·
http://www.javatang.com/_download/css2handbook.rar ......
clip:rect(ÉÏ£¬ÓÒ£¬Ï£¬×ó) Ëĸöµã×ø±ê
<img src="1.jpg" style=" clip:rect(0£¬30£¬10£¬10);"/>
´Ë·½·¨²»ÊʺϼôÇб³¾°
±³¾°Ê¹ÓÃ
style="background-image:url(bg.jpg); background-position:20px 0px;"
kground-position:
1.¶¨Î»·½·¨ left center ºáÏò ×ÝÏò
2.ÇÐÈ¡ ºáÏòpx ×ÝÏòpx
²»ÊÊºÏÆ ......
Ê×ÏÈÊÇHTML´úÂë:
<div id="outer">
<div id="leftFrame" style="width: 20%;">
<div style="height: 30%" id="packageListFrame" title="All Packages" >
Package list goes here
</div>
&n ......
ÈÃleftµÄ¸ß¶ÈµÈÓÚ centerµÄ¸ß¶È..........
<div id=left></div>
<div id=center></div>
<script type="text/javascript">
document.getElementById("left").style.height = document.getElementById("center").offsetHeight + "px";
</script> ......
1¡¢ÍøÒ³¾ÓÖÐÏÔʾ£º
ÐèÒªÉèÖÃÁ½¸öµØ·½£¬Ò»¸öÊÇbody£¬Ò»¸öÊÇÍâ±ß¿òdiv¡£
CSS£º
body{
margin:0;
padding:0;
text-align:center;
}
#main{ /*×îÍâ²ãDIV*/
width:760px;
margin:0 auto;
padding:0
}
2¡¢ÎÄ×Ö´¹Ö±¾ ......