更改背景图像重复文件
我想知道当旧图像用完时是否可以更改背景图像重复的文件。
那么,如果将 image01.jpg 设置为第一个背景图像,当它垂直用完时,image02.jpq 将被添加为背景图像以完成页面?
这可能是一个直接的“不”,没关系,我只是想知道
I was wondering if it's possible to change what file the background image repeats to when the old image runs out.
So, if image01.jpg is set as the first background-image, when it runs out vertically image02.jpq would be added as the background image to complete the page?
It might be a straight 'No', thts fine im just wondering
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 CSS3,您可以拥有多个背景。您可以为它们中的每一个指定一个
background-repeat
。 所有主流浏览器均支持,IE8 及更早版本除外。http://www.css3.info/preview/multiple-backgrounds/
With CSS3 you can have multiple backgrounds. You can specify a
background-repeat
for each of them. It is supported by all major browsers, except IE8 and before.http://www.css3.info/preview/multiple-backgrounds/
如果您愿意向文件添加更多标记,CSS 中总有解决方案。最好的办法是用一个包含 div 来包装第一个图像所在的元素,并在第一个图像用完时使用您希望显示的背景。像这样:
HTML:
CSS:
当然,您也可以随时将
替换为实际图像。
There's always a solution for something in CSS if you're willing to add more markup to your file. Your best bet is to wrap the element you have the first image in with a containing div with the background you would like to appear if the first image runs out. Like so:
HTML:
CSS:
Of course you can always replace the
<span>
with an actual image as well.不要忘记 HTML 也是一个元素。
正文背景将位于平铺 html 背景之上。适用于所有浏览器,不需要额外的标记。
Don't forget that HTML is an element, too.
The body background will sit on top of the tiling html background. Works in every browser and won't require additional markup.