图像流体无法在Bootstrap 4上运行

时间:2018-04-16 15:27:55

标签: html css bootstrap-4

我在使用Bootstrap 4制作图像时遇到问题?当下面的代码呈现给浏览器时,导航栏中有三个图像(左上角)。在移动设备上查看时,这三个图像尺寸缩小了我的问题!

我希望导航栏中的两个colunms并排放置,图像缩小,文本右对齐。此时两列不是并排放置,因为图像没有响应,第二列被强制下方?

我有一个更大的旋转木马,这似乎工作正常!我不确定为什么这个工作而其他图像不是?我可能在这里做了一些非常愚蠢的事情,但我很感激有人突出我出错的地方,以免我拉出我的头发。提前致谢

<html>
<head>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
    integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <style type="text/css">
      .contact {
        text-align: right;
      }
    </style>
</head>
<body>
  <div class="container-fluid">
    <nav class="navbar px-0">
      <div class="row col-lg-12 px-0">
        <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 no-right-padding">
          <img class="img-fluid" src="http://via.placeholder.com/160x40" alt=""><img class="img-fluid" src="http://via.placeholder.com/160x40" alt="">
          <br>
          <a class="navbar-brand" href="index.html">
            <img class="img-fluid" src="http://via.placeholder.com/160x160" style="margin-top: 10px;" alt="">
          </a>
        </div>
        <div class="contact col-lg-6 col-md-6 col-sm-6 col-xs-6 px-0">
          <p><a href="contact.html">Some heading</a></p>
          <div style="padding-top: 30px;">
            <p>Some random text
          </div>
        </div>
      </div>
    </nav>

    <div class="col-lg-12 px-0 carousel slide carousel-fade animated fadeIn" id="carousel" data-ride="carousel">
        <div class="carousel-inner">
          <div class="carousel-item active">
            <img class="img-fluid" src="http://via.placeholder.com/1736x890" alt="First slide">
          </div>
          <div class="carousel-item">
            <img class="img-fluid" src="http://via.placeholder.com/1736x890" alt="Second slide">
          </div>
          <div class="carousel-item">
            <img class="img-fluid" src="http://via.placeholder.com/1736x890" alt="Third slide">
          </div>
        </div>
      </div>
  </div>

  <!-- bootstrap 4 js & jQuery -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

</body>

2 个答案:

答案 0 :(得分:3)

问题在于使用bootstrap类。

bootstrap 4中现在没有col-xs-6col-6

以下是工作人员:Side by side columns

我还从col-lg-12

中删除了<div class="row col-lg-12 px-0">

答案 1 :(得分:0)

您的第一个HTML IMG标签会在彼此旁边列出两次。确保它不在您的文本编辑器中。