【发布时间】:2012-06-02 01:02:41
【问题描述】:
可能重复:
Stretch and Scale a CSS image Background - With CSS only
我想设置 div 背景图片 div(width: 1000, min-height: 710) 并且图片尺寸是 753 x 308 我试图设置它的图像不适合 div 大小我该怎么办?
.Invitation {
background-color: transparent;
background-image: url('../images/form.png');
background-repeat: no-repeat;
background-position: left top;
background-attachment: scroll;
background-size: 100%;
width: 1000px;
height: 710px;
margin-left: 43px;
}
div类是
.content {
clear:both;
width:1000px;
background:#e7e8e9;
background-image:url('../images/content.jpg');
background-repeat:no-repeat;
background-position:left top;
min-height:710px;
}
代码是
<div class="content"><div class="Invitation">form goes here....</div></div>
【问题讨论】:
-
您是否要缩放背景图像以适应(按比例)或拉伸(扭曲)到 DIV?
-
图片应该覆盖div。
标签: css image html background