简体   繁体   English

背景图像的超大尺寸

[英]Jumbotron size of background image

I am trying to make a Jumbotron background the size of an image. 我正在尝试使Jumbotron背景图像的大小。 When I try to do: 当我尝试做时:

.jumbotron {
  background: url("img/img.gif");
}

The image is cropped within the bounds of the jumbotron; 图像在超大范围内裁剪。 how do I get it so the image is the width of the jumbotron but the length of the image? 我如何获得图像,所以图像是超长管的宽度,但是图像的长度呢?

Thanks 谢谢

Specify the width and height you would like in the CSS bro. 在CSS兄弟中指定所需的宽度和高度。

.jumbotron {
  width: x
  background: url("img/img.gif");
}

Then have an image class, 然后有一个图像课,

.img-height {
height: x;
}

If you want to get crazy with it and make it dynamically set the jumbotron's width and height I would suggest JQuery. 如果您想对它疯狂,并使其动态地设置巨型机的宽度和高度,我建议使用JQuery。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM