代码一:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030" />
<title>Untitled Document</title>
<style type="text/css">
a
{
    
/* 以下行在标准浏览器必需,IE6可选 */
    display
:table-cell;
    vertical-align
:middle;
    width
:300px;
    height
:300px;
    
    
/* 以下可选 */
    text-align
:center;
    border
:1px solid #CCC;
}
img
{
    border
:1px dotted #999;
}
</style>
<!--[if lte IE 7]>
<style type="text/css">
a{
    line-height:300px; /* 与 a 的高度相同 */
    display:block; /* 不支持 table-cell,用 block 替代,否则不能水平居中 */
}
img{
    vertical-align:middle;
}
span{
    display:inline-block;
}
</style>
<![endif]
-->

</head>

<body>
    
<href="#" /><img src="http://img.baidu.com/img/img-jg.gif" /><span></span></a>
</body>
</html>

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-13
  • 2021-07-05
  • 2022-01-13
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
相关资源
相似解决方案