节背景图片在boostrap中没有响应

时间:2019-04-17 09:15:08

标签: html5 css3 bootstrap-4 responsive responsive-images

我想使Bootstrap4中的节背景响应。 下面可以正常工作,但测试时图像变小。

如何使用Bootstrap 4 a和CSS使背景部分图像响应。 我已经附加了引用代码,输出应该如下所示 enter image description here

body {
    font-family: 'Roboto';
    color: #a0a6ad;
    font-size: 14px;
    font-weight: 400;
    background: #fff;
    overflow-x: hidden;
    padding-top:4.7rem;
}
section.bgimage {
    width: 100%;
    padding:0 7%;
    display: table;[![enter image description here][1]][1]
    max-width: 100%;
    background-image: url('../images/Banner_bg_desktop.png');
    background-size: cover; 
    background-repeat: no-repeat;
    height: 100%;
}
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<section class="bgimage">
    <div class="container headersection">
        <div class="row align-items-center">
            <div class="col-sm-4 hearder_text">
                Welcome
            </div>
            <div class="col-sm-8 p-4">  
                <img src="../images/tw_model.png" style="width:100%" class="img-fluid">
            </div>
        </div>
    </div>
</section>


</body>
</html>

0 个答案:

没有答案