垂直拉伸背景图像 [英] Vertically stretch background image

查看:47
本文介绍了垂直拉伸背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何垂直拉伸背景图像.我通过以下方式将CSS3与3张图片一起使用:

I am trying to figure out how to stretch a background image vertically. I am using CSS3 with 3 images in the following way:

background-image: url("left.png"), url("right.png"), url("center.png")
background-repeat: no-repeat, no-repeat, repeat-x
background-position: top left, top right, top

现在,我想垂直拉伸这些图像,使其一直延伸到底部.有办法吗?

Now I want to stretch these images vertically to that they extend all the way to the bottom. Is there a way to do this?

推荐答案

我在这里参加聚会很晚,但这对我有用:

I'm late to the party here, but this is what worked for me:

background-size: auto 100%;

这将垂直适合图像,并让宽度做任何需要做的事情(我认为默认情况下会重复).您还可以设置:

This will fit the image vertically and let the width do whatever it needs to do (i think it repeats by default). You can also set:

background-repeat: no-repeat;

不要在水平方向上重复图像.

for it to not repeat the image in the horizontal direction.

这篇关于垂直拉伸背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆