[英]How to make an image responsive from CSS
我在CSS类中添加图像。 现在,我需要使用img-responsive
Bootstrap方法来使该图像响应。 我怎样才能做到这一点 ?
我的代码:
CSS
.mybackground {
max-width: 100%;
max-height: 100%;
width: 100%;
height: 100vh;
vertical-align: top;
background: url(img.png) ;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
注意:我已经在CSS类中添加了图像。
我强烈建议您看以下内容:
首先是Bootstrap中的img
项目: http : //getbootstrap.com/css/#images
然后确认您进行了适当的媒体呼叫: http : //getbootstrap.com/css/#sensitive-utilities
将以下内容添加到CSS
。
height: 100%;
background: url(".....") no-repeat;
background-size: 100% auto;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.