CSS:img的边距

CSS:img的边距,css,Css,我有如下html: <div id="userBar"> <a href="notifications.php" class="iconGlobe"></A> <a href="cp.php" class="iconCP"></a> <a href="cap.php" class="iconCAP"></a> </div> .iconGlobe{ background: url(..

我有如下html:

    <div id="userBar">
<a href="notifications.php" class="iconGlobe"></A>
<a href="cp.php" class="iconCP"></a>
<a href="cap.php" class="iconCAP"></a>
    </div>
.iconGlobe{
background: url(../images/icons/globe_16x16.png) no-repeat;
width: 16px;
height: 16px;
border: none;
display:inline-block;
position:relative;
text-decoration:none;
}
#userbar a{
margin-right: 8px; 
}
我试图在锚定链接之间留出空间,如下所示:

    <div id="userBar">
<a href="notifications.php" class="iconGlobe"></A>
<a href="cp.php" class="iconCP"></a>
<a href="cap.php" class="iconCAP"></a>
    </div>
.iconGlobe{
background: url(../images/icons/globe_16x16.png) no-repeat;
width: 16px;
height: 16px;
border: none;
display:inline-block;
position:relative;
text-decoration:none;
}
#userbar a{
margin-right: 8px; 
}
但是我没有申请保证金。我试着在室内做这件事。我的大脑有一个边缘,这很好。我不希望单独应用它们。

尝试以下方法:

#userbar a{
   display: block;
   float: left;
   margin-right: 8px;
}
试试这个:

#userbar a{
   display: block;
   float: left;
   margin-right: 8px;
}

这是案件的问题吗?在你的html中你有


-注意国会大厦B,在CSS中,您有这是一个案例问题?在你的html中你有

#userbar a{
-请注意capitol B,在CSS中,您不能为内联元素提供边距。将代码更改为:

#userbar a{
#userbar a{
display: inline-block;
margin-right: 8px; 
}

但是请注意,旧版本的IE可能会忽略这一点…

您不能为内联元素提供边距。将代码更改为:

#userbar a{
display: inline-block;
margin-right: 8px; 
}

但是请注意,旧版本的IE可能会忽略这一点…

您的代码是正确的。问题在于#useBar和id='useBar'的大小写不匹配。当案例得到纠正时,它可以正常工作。请参见此处-

您的代码是正确的。问题在于#useBar和id='useBar'的大小写不匹配。当案例得到纠正时,它可以正常工作。请参见此处-

如果父div“断开”,请尝试此:+如果父div“断开”,请尝试此:+我认为您不需要
位置:relative打开。iconGlobe。您正在测试哪个浏览器?你有活生生的例子吗?我认为你不需要
位置:relative打开。iconGlobe。您正在测试哪个浏览器?你有活的例子吗?内联块元素可以有边距内联块元素可以有边距