【发布时间】:2009-08-08 22:07:55
【问题描述】:
我有一个圆角矩形的图像,我将它用于背景的顶部和底部,方法是:
#content_top { /* 760px by 30px */
background: #F7EECF url(images/content_top_bottom_bg.png) no-repeat 0 0 scroll;
height: 10px;
}
#content_bottom { /* 760px by 30px */
background: #F7EECF url(images/content_top_bottom_bg.png) no-repeat 0 -20px scroll;
height: 10px;
}
然后我使用另一个 1px 高度的图像垂直重复以填充该 div 背景之间的区域。像这样:
#content { /* 760px by 1px */
background: #F7EECF url(images/content_body.png) repeat-y 0 0 scroll;
}
现在我想知道是否可以只使用相同的图像 (content_top_bottom.png),但只使用其中的一部分来达到相同的效果?我尝试了类似的方法,但没有成功:
#content { /* 760px by 1px */
background: #F7EECF url(images/content_top_bottom.png) repeat-y 0 -5px scroll;
}
我想使用相同的图像,因为我想减少 http 请求的数量。 1px 的图像可能不会产生很大的影响,但我只是想尝试一下。有人可以帮忙吗?
【问题讨论】:
标签: html css background