Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将图像放在div的左侧,不使用右边距_Html_Css - Fatal编程技术网

Html 将图像放在div的左侧,不使用右边距

Html 将图像放在div的左侧,不使用右边距,html,css,Html,Css,我试图将3个图像放在div的左侧,而不使用右边距: 我为图像想到了:float:left,但它不起作用 这是我的JSFIDLE: html: <center> <div id="container" style="width:700px;"> <div id="header" style="background-color:rgb(249,204,157);"> <font style="margin-bottom:0; te

我试图将
3个图像
放在div的
左侧
,而不使用
右边距

我为图像想到了:
float:left
,但它不起作用

这是我的JSFIDLE:

html

<center>
<div id="container" style="width:700px;">

    <div id="header" style="background-color:rgb(249,204,157);">
        <font style="margin-bottom:0; text-align: center;font-size: 50px;">avb</font>
        <img src="image.jpg" style="cursor: pointer; width: 76px; height: 60px; position: fixed; margin-right: 154px;">
        <img src="image.jpg" style="cursor: pointer; width: 66px; height: 59px; position: fixed; margin-right: 85px;">
        <img src="image.jpg" style="cursor: pointer; width: 77px; height: 62px; position: fixed; margin-right: 5px;">
    </div>

    </div>

</center>
<style>
#container { float: center; }

body {
  padding: 25px;
}

</style>

avb
风格

<center>
<div id="container" style="width:700px;">

    <div id="header" style="background-color:rgb(249,204,157);">
        <font style="margin-bottom:0; text-align: center;font-size: 50px;">avb</font>
        <img src="image.jpg" style="cursor: pointer; width: 76px; height: 60px; position: fixed; margin-right: 154px;">
        <img src="image.jpg" style="cursor: pointer; width: 66px; height: 59px; position: fixed; margin-right: 85px;">
        <img src="image.jpg" style="cursor: pointer; width: 77px; height: 62px; position: fixed; margin-right: 5px;">
    </div>

    </div>

</center>
<style>
#container { float: center; }

body {
  padding: 25px;
}

</style>

#容器{float:center;}
身体{
填充:25px;
}

感谢您的帮助

移除你的
位置:固定并提及您的css样式,如下所示。。。不需要为每个img编写单独的样式

img
{
    float: left;
    width: 76px;
    height: 60px;
    margin-right: 5px;
}

我认为
浮动:左
不起作用,因为图像上有
位置:固定
。 当我添加这个css,并删除位置:修复它看起来几乎像在你的图片

img{
    float: left;
    margin-right: 5px;
}
并尝试使用类而不是内联样式。:)


avb


这似乎对我有用。

从图像中删除固定位置!然后再把
位置:fixed
放在你的
img
上,放在它的容器上。谢谢!你能把
avb
放在中间吗?我使用了:text align:center,但它不在中心。边距:0不起作用。@AlonShmiel:它实际上在中间,请尝试通过拖动使小提琴中的结果变大。。!!非常感谢。你能把avb放在中间吗?我使用了:text align:center,但它不在中心。边距:0不起作用。