【问题标题】:Bootstrap - add image responsiveness to CSS background imageBootstrap - 为 CSS 背景图像添加图像响应能力
【发布时间】:2014-06-03 12:49:50
【问题描述】:

在Bootstrap中,你可以设置an的类来调整视口的大小:

<img src="..." class="img-responsive">

如何使用带有 CSS 背景图像的 Bootstrap?

background: url(../images/MyImage.png) center center no-repeat;

【问题讨论】:

标签: css twitter-bootstrap responsive-design


【解决方案1】:

尝试将此行添加到您的 css 代码中。

background-size: cover;

【讨论】:

    【解决方案2】:

    您可以尝试以下 css 以获得完整背景:

    img{
    background: url(../images/MyImage.png) o-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-09-18
      • 2014-03-26
      • 2016-12-13
      • 1970-01-01
      • 1970-01-01
      • 2019-07-02
      相关资源
      最近更新 更多