简体   繁体   English

Bootstrap-根据设备屏幕大小调整Jumbotron图像背景的大小

[英]Bootstrap - Resize Jumbotron Image Background Coverage Based On Device Screen Size

I am using a Bootstrap jumbotron to display list results. 我正在使用Bootstrap巨型显示面板来显示列表结果。 This jumbotron uses an image as the background which is set to cover 50% of the width and 100% of the height initially. 该巨型电子白板使用图像作为背景,该图像最初设置为覆盖宽度的50%和高度的100%。 Please find below the style code implemented in the HTML div of the jumbotron: 请在下面找到在jumbotron的HTML div中实现的样式代码:

style="width:80%;max-width:750px;min-height:220px;
background:url({{ property.properties_pictures.property_image1.url }});
background-size:50% 100%;background-repeat:no-repeat;
list-style-type:none;border:solid;border-width:1px;border-color:#d6d0ca;"

I would like to inverse the coverage of the background image to 100% of the width and 50% of the height for devices that have a screen width of less than 500px. 对于屏幕宽度小于500px的设备,我想将背景图像的覆盖率倒置为宽度的100%和高度的50%。

I tried using media queries with no luck: 我尝试使用没有运气的媒体查询:

@media (max-width: @screen-sm-min)
{
.jumbotron
{
    background-size: 100% 50%;;
}
}

It would be great if anyone could help on this. 如果有人可以为此提供帮助,那就太好了。

Thanks. 谢谢。

You should use your media queries in this format-- 您应该以这种格式使用媒体查询-

@media only screen and (max-width:500px){
.jumbotron
{
    background-size: 100% 50%;;
}
}

Hope this helps! 希望这可以帮助!

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

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