我想在html模板中设置背景图片。图像大小为1600 x 1200.我想将背景图像设置为固定。当屏幕尺寸较小(放大和缩小电子邮件模板)时,电子邮件模板中会出现许多图像。我想将背景图像设置为一个图像,而不依赖于html模板中计算机的屏幕尺寸。提前谢谢。
答案 0 :(得分:0)
.imgcon
{
background-image: url("http://ichef.bbci.co.uk/wwfeatures/wm/live/1280_640/images/live/p0/3x/sw/p03xsw49.jpg");
width: 1600px;
height: 1200px;
background-repeat: no-repeat;
background-size: 100% auto;
background-position: center top;
background-attachment: fixed;
color:white;
}
<div class="imgcon">
This is a div that has a fixed background. This text will overlap on the top of the background image.
</div>