<!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 type="text/css">
.rating a{width:16px;height:16px;overflow:hidden;display:inline-block;}
</style>
</head>
<body>
<div class="rating">
<a href="#">1star</a>
<a href="#">2star</a>
<a href="#">3star</a>
<a href="#">4star</a>
<a href="#">5star</a>
</div>
</body>
</html>
我为.rating中的一组a元素设置display:inline-block;后发现每两个a中间有会空隙,但是将display:inline-block;换成display:block;float:left;后却是正常的(即中间没有空隙),这是为什么呢?求各位指点!先谢啦!
------解决方案--------------------
参考下吧
http://www.zhangxinxu.com/wordpress/2012/04/inline-block-space-remove-%e5%8e%bb%e9%99%a4%e9%97%b4%e8%b7%9d/
------解决方案--------------------
display: inline;
clear:both;