<style type="text/css">
<!--
* {margin:0;padding:0}
div {
  width:500px;
  height:500px;
  border:1px solid #666;
  overflow:hidden;
  position:relative;
  display:table-cell;
  text-align:center;
  vertical-align:middle
}
div p {
  position:static;
  +position:absolute;
  top:50%
  }
img {
  position:static;
  +position:relative;
  top:-50%;left:-50%;
  }
-->
</style>
<div><p><img src="http://www.google.com/intl/en/images/logo.gif" /></p></div>

posted @ 2011-03-20 21:55 乌卡卡 阅读(26) 评论(0) 编辑

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>鼠标经过图片半透明效果,支持Firefox/IE</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
      body {background:#000;}
      .img_link{filter:alpha(opacity=50); /* IE */
            -moz-opacity:0.5; /* Moz + FF */
            opacity:0.5; /* 支持CSS3的浏览器(FF 1.5也支持)*/
          }
      .img_link:hover {
            filter:alpha(opacity=100); /* IE */
            -moz-opacity:1; /* Moz + FF */
           opacity:1; /* 支持CSS3的浏览器(FF 1.5也支持)*/
           }
    </style>
  </head>
  <body>
   <img class="img_link" src="http://www.tmxhx.com/attachments/month_0808/k2008823103739.jpg" alt="测试效果"  onMouseOver="this.className='null'" onMouseOut="this.className='img_link'" />
  </body>
</html>

posted @ 2011-03-20 20:27 乌卡卡 阅读(9) 评论(0) 编辑