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不起作用。