<style>
.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;
}
</style>

 

html:

 

1 <div class="box"><href="http://www.howpm.com" target="_blank"><img src="http://howpm.com/images/dz7/logo.gif" /></a></div>

相关文章:

  • 2021-06-24
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-01-13
  • 2021-12-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-30
  • 2021-11-18
  • 2021-11-01
  • 2021-09-17
  • 2021-11-21
相关资源
相似解决方案