日期:2014-05-16  浏览次数:20583 次

ie8下 line-height怎么不起作用

<!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=utf-8" />
<title>无标题文档</title>
<style>
body {
    font: 12px/24px Helvetica,Tahoma,Arial,sans-serif;    
margin: 0;
    padding:0;
}
div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, form, input, textarea, p {
    margin: 0;
    padding: 0;
}
img {
    border: 0 none;   
}
*{
margin:0;
padding:0;
}
li{ 
   list-style:none;
}
.fl{
float:left;
display:inline;
}
.fr{
float:right;
display:inline;
}
a{ 
   text-decoration:none;
   color:#313131;
}
a:hover{ 
   text-decoration:none;
}
.a_d{
height:22px;
padding:0 10px 0 5px;
border:1px solid #9dabb6;
border-radius:3px;
line-height:22px;
display:inline-block;
background:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e7f0f9));
background:-moz-linear-gradient(top, #ffffff,#e7f0f9);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#e7f0f9,grandientType=1);
margin:100px 100px;
}
</style>

</head>

<body>
<a class="a_d" href="#">保存</a>
</body>


</html>
在ie8下 line-height没有垂直居中是怎么回事啊

------解决方案--------------------
引用:
Quote: 引用:

Quote: 引用:

Quote: 引用:

line-height不设也可以,非得设就把边线也算上


不设置火狐就不兼容了 有没有ie 火狐 谷歌都兼容的办法啊

line-height:24px
把边线的宽度算上


算上边框线 火狐不兼容了 都试过了 火狐就多出两个像素了

body {
    font: 12px/24px sans-serif;   
    margin: 0;
    padding:0;
}
好像是字体问题 前面几个删掉了就好了