我的背景图片不适合自举式jumbotron

时间:2016-08-10 07:02:36

标签: css twitter-bootstrap-3

  

我制作的全尺寸图片将覆盖整个jumbotron,但图像是从jumbotron中解决的,任何人都可以帮我解决这个问题

BatteryManager mBatteryManager = (BatteryManager) getSystemService(Context.BATTERY_SERVICE);
    Long avgCurrent = null, currentNow = null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        avgCurrent = mBatteryManager.getLongProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_AVERAGE);
        currentNow = mBatteryManager.getLongProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW);
    }
    Log.d(TAG, "BATTERY_PROPERTY_CURRENT_AVERAGE = " + avgCurrent + "mAh");
    Log.d(TAG, "BATTERY_PROPERTY_CURRENT_NOW =  " + currentNow + "mAh");

3 个答案:

答案 0 :(得分:0)

使用班级.img-responsive。显然,图像将包含足够的宽度。

<div class="jumbotron" style="position:relative;">
      <img src="Add a new customer   SmartStore.NET administration.png" class="img-responsive" alt="jumbotron" style="position:absolute; top:0; bottom:0; left:0; right:0; background-size:cover;">
 </div>

答案 1 :(得分:0)

不需要为此设置内联样式表,只需在图像中使用img-responsive类,请参阅以下答案。

 <div class="col-md-12">
        <div class="jumbotron">
            <img src="images/bg_image%20(1).jpg" alt="jumbotron" class="img-responsive">
        </div>
 </div>

答案 2 :(得分:0)

因此,您可以通过CSS的背景属性轻松链接图像,而不是使用图像标记。请参阅以下代码:

<style>
.jumbo_bg{
 background: url('../images/bg_image%20(1).jpg');
 background-position: center center;
 background-size: cover;
 height: auto /* or if you wish to give any height instead of auto use any px value like 150px;*/
}
</style>

<div class="col-md-12">
    <div class="jumbotron jumbo_bg">
        <!-- Add Your text here -->
    </div>
</div>

这适用于所有屏幕尺寸。