Html 图像之间的填充不会';t垫 #动作图标 { 浮动:对; } #action-icons.img { 位置:相对位置; 顶部:-30px; 右边填充:200px; } 一些漂亮的标题

Html 图像之间的填充不会';t垫 #动作图标 { 浮动:对; } #action-icons.img { 位置:相对位置; 顶部:-30px; 右边填充:200px; } 一些漂亮的标题,html,css,padding,Html,Css,Padding,尝试添加: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> #action-icons { float:right;

尝试添加:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<style type="text/css">
#action-icons
{
    float:right;
}
#action-icons.img
{
    position:relative;
    top:-30px;
    padding-right:200px;
}
</style>
</head> 

<body> 
    <h1 class="edit">Some nifty title
    <span id="action-icons"> 
    <img src="foo.png" width="64" height="64" alt="" id="newsticky"/> 
    <img src="bar.png" width="60" height="60" alt="" id="trash"/> 
    </span> 
    </h1> 
</body> 
</html>
也许可以

编辑:您有
#动作图标。img
删除点,使其成为
#动作图标img

该点将
img
设置为一个类,因此,如果您拥有它,HTML将如下所示:

#action-icons.img
{
    position:relative;
    top:-30px;
    padding-right:200px;
}

希望能有帮助

编辑-以下是完整的工作代码:

<img src="bar.png" width="60" height="60" alt="" id="trash" class="img"/>

#动作图标
{
浮动:对;
}
#动作图标
{
位置:相对位置;
顶部:-30px;
左边距:50像素;
}
一些漂亮的标题
尝试添加:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<style type="text/css">
#action-icons
{
    float:right;
}
#action-icons.img
{
    position:relative;
    top:-30px;
    padding-right:200px;
}
</style>
</head> 

<body> 
    <h1 class="edit">Some nifty title
    <span id="action-icons"> 
    <img src="foo.png" width="64" height="64" alt="" id="newsticky"/> 
    <img src="bar.png" width="60" height="60" alt="" id="trash"/> 
    </span> 
    </h1> 
</body> 
</html>
也许可以

编辑:您有
#动作图标。img
删除点,使其成为
#动作图标img

该点将
img
设置为一个类,因此,如果您拥有它,HTML将如下所示:

#action-icons.img
{
    position:relative;
    top:-30px;
    padding-right:200px;
}

希望能有帮助

编辑-以下是完整的工作代码:

<img src="bar.png" width="60" height="60" alt="" id="trash" class="img"/>

#动作图标
{
浮动:对;
}
#动作图标
{
位置:相对位置;
顶部:-30px;
左边距:50像素;
}
一些漂亮的标题

试试
右边距

和使用

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<style type="text/css">
#action-icons
{
    float:right;
}
#action-icons img
{
    position:relative;
    top:-30px;
    margin-left:50px;
}
</style>
</head> 

<body> 
    <h1 class="edit">Some nifty title
    <span id="action-icons"> 
    <img src="foo.png" width="64" height="64" alt="" id="newsticky"/> 
    <img src="bar.png" width="60" height="60" alt="" id="trash"/> 
    </span> 
    </h1> 
</body> 
</html>
来处理图像

#action-icons img 

表示“具有ID
动作图标和类
img
的任何元素

和使用

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<style type="text/css">
#action-icons
{
    float:right;
}
#action-icons img
{
    position:relative;
    top:-30px;
    margin-left:50px;
}
</style>
</head> 

<body> 
    <h1 class="edit">Some nifty title
    <span id="action-icons"> 
    <img src="foo.png" width="64" height="64" alt="" id="newsticky"/> 
    <img src="bar.png" width="60" height="60" alt="" id="trash"/> 
    </span> 
    </h1> 
</body> 
</html>
来处理图像

#action-icons img 
表示“具有ID
动作图标和类
img

更改的任何元素”

#action-icons.img

检查

它在firefox上对我有效

#action-icons.img

检查


它在firefox上适用于我

@ripper此外,请使用
img#action icons
而不是
#action icons.img
。就目前而言,这条规则不适用。你的答案仍然不起作用@凯尔成功了。谢谢你的努力。@Pekka:除非我弄错了,
img#action icons
会将任何img与id“action icons”匹配。您需要
#动作图标img
-任何id为“动作图标”的节点后代的图像。@ripper此外,请使用
img#动作图标
而不是
#动作图标。img
。就目前而言,这条规则不适用。你的答案仍然不起作用@凯尔成功了。谢谢你的努力。@Pekka:除非我弄错了,
img#action icons
会将任何img与id“action icons”匹配。你想要
#action icons img
-任何id为“action icons”的节点后代的图像。呵呵,原来不需要内联,问题只是我的选择器。很公平,我还是花了一段时间才看到选择器:)呵呵,原来不需要内联,问题只是我的选择器。很公平,我花了一段时间才看到选择器:)