我在流体div中将流体图像水平居中时遇到问题。从高低看,别人发现的解决方案对我不起作用,或者我正在尝试做某事太过努力(我对此表示怀疑),或者我正在使用其他媒介。
HTML:
<body>
<div id="BackgroudDiv">
<img src="images/NumberTwo.png" alt="" id="FSBG"/>
</div>
</body>
CSS:
body {
margin: 0px
}
#FSBG {
width: auto;
height: 100%;
min-width: 1040px;
position: absolute;
min-height: 585px;
}
#BackgroudDiv {
width: 100%;
height: 1080px;
text-align: center;
display: block;
background-color: #BF2527;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
}
“保证金:自动”不执行任何操作,因为所有内容的宽度都是可变的。在原样的代码中,图像“ NumberTwo”的左边缘在页面上居中。我希望图像的中心居中。它的行为与应按比例缩放的行为相同,但不在页面中间!
任何帮助将不胜感激,它一直在推动我前进。让我知道是否需要更多信息。
H
您只需要删除position: absolute;
中的img
:
#FSBG {
width: auto;
height: 100%;
min-width: 1040px;
min-height: 585px;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句