0

样本:

<!DOCTYPE html>
<html>
<head>
<title></title>
   <style type="text/css">
    #container {width:300px; overflow-x:auto; overflow-y:hidden; white-space:nowrap;}
    img {border:0;}
   </style>
</head>
<body>
   <div id="container">
    <a href="#"><img src="http://lh3.googleusercontent.com/-hUXeHq5OxEo/Thc7hFFv3gI/AAAAAAAAABQ/Yh7omR8iwzI/s800/thumb1.jpg" alt=""></a>
    <a href="#"><img src="http://lh3.googleusercontent.com/-hUXeHq5OxEo/Thc7hFFv3gI/AAAAAAAAABQ/Yh7omR8iwzI/s800/thumb1.jpg" alt=""></a>
    <a href="#"><img src="http://lh3.googleusercontent.com/-hUXeHq5OxEo/Thc7hFFv3gI/AAAAAAAAABQ/Yh7omR8iwzI/s800/thumb1.jpg" alt=""></a>
    <a href="#"><img src="http://lh3.googleusercontent.com/-hUXeHq5OxEo/Thc7hFFv3gI/AAAAAAAAABQ/Yh7omR8iwzI/s800/thumb1.jpg" alt=""></a>
    <a href="#"><img src="http://lh3.googleusercontent.com/-hUXeHq5OxEo/Thc7hFFv3gI/AAAAAAAAABQ/Yh7omR8iwzI/s800/thumb1.jpg" alt=""></a>
   </div>
</body>
</html>

如何将链接之间的空间减少到 1px?

提前谢谢了!

麦克风

4

3 回答 3

1

This should hopefully work:

* {padding:0;margin:0;}
div#container {overflow:auto;}
img {float:left;margin-right:1px;border:0;}
于 2012-07-04T09:56:29.790 回答
1

删除它们之间的空格。将它们全部放在一条线上,否则它们之间会出现空格。

于 2012-07-04T02:50:43.540 回答
0

vertical-align:top;嘿,像这样在你的 CSS 中添加 img 属性

img {
    border: 0 none;
    vertical-align: top;
}

现场演示http://jsfiddle.net/nZKv8/

于 2012-07-04T04:35:28.957 回答