E6,IE7下面给display: inline-block的元素设置text-indent: -9999px会把这个元素以及后面的元素拉走,请问有没有什么比较好的办法解决?今天头一次碰到。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<title>TEST</title>
<style type="text/css">
.bar {
border: 1px solid;
display: inline-block;
height: 18px;
}
.bar .icon {
display: inline-block;
width: 16px;
height: 16px;
background: red;
text-indent: -9999px;
}
</style>
<!--[if lte IE 7]>
<style type="text/css">
.bar {
display: inline;
}
</style>
<![endif]-->
</head>
<body>
<div class="bar">
<span class="icon"></span>
<span>HELLO KITTY HELLO KITTY HELLO KITTY</span>
</div>
</body>
</html>
解决:
用浮动<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<title>TEST</title>
<style type="text/css">
.bar { border: 1px solid; display: inline-block; height: 18px;}
.bar .icon { display: block;float:left;width: 16px; height: 16px; background: red; text-indent: -9999px; }
</style>
<!--[if lte IE 7]>
<style type="text/css">
.bar {
display: inline;
}
</style>
<![endif]-->
</head>
<body>
<div class="bar"> <span class="icon"></span> <span>HELLO KITTY HELLO KITTY HELLO KITTY</span> </div>
</body>
</html>另外,可否考虑定位呢?