视口大于中等时奇怪的垂直溢出

时间:2017-11-06 17:28:00

标签: css twitter-bootstrap twitter-bootstrap-3 sass

我使用bootstrap-sass来布局垂直堆栈中的一些div元素。但是,当视口高于md大小div元素溢出并生成垂直滚动条时,我遇到了问题。

演示 https://nyc3.digitaloceanspaces.com/bingo-assets/index.html

这是我的grid.scss文件:

@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap/variables";
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap/mixins";
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap/grid";
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap/responsive-utilities";

.row {
  @include make-row();
}

#content {
  @include container-fixed;
}

#promo-header {
  @include make-sm-column(12);
}

#subscribe {
  @include make-sm-column(12);
}

#video {
  @include make-sm-column(12);
}

#factoid {
  @include make-sm-column(12);
}

下面是HTML:

<div id="content">
  <div class="row">
    <div id="promo-header">
        <img width="100%" src="/images/promo.jpg">
    </div>

    <div id="subscribe">
      <h2>Simply enter your details for a chance to win!</h2>
      <form name="subscribe">
        <div>
          <label>Firstname</label>
          <input type="text" name="firstname" />
        </div>

        <div>
          <label>Surname</label>
          <input type="text" name="surname" />
        </div>

        <div>
          <label>Email</label>
          <input type="text" name="email" />
        </div>

        <div>
          <label>Telephone</label>
          <input type="text" name="telephone" />
        </div>

        <div>
          <label>Postcode</label>
          <input type="text" name="postcode" />
        </div>

        <div>
          <label>Have you seen this product on TV?</label>
          <select name="question">
            <option value>Please Select</option>
            <option value="Y">Yes</option>
            <option value="N">No</option>
          </select>
        </div>

        <button class="btn">Get Your Coupon</button>
        <small>Please note: Only one coupon available per person and only one email address allowed per person. Coupon valid 02.10.17 - 31.03.18. Redeemable by UK residents 18+ only in participating stores only.</small>
      </form>
    </div>

    <div id="video">
      <div id="video-container">
        <iframe src="https://www.youtube.com/embed/ZZa7Kgo0apA" frameborder="0" allowfullscreen></iframe>
      </div>
      <div id="description">
        <h2>Video Title</h2>
        <p>Do you want to cook amazing meals?</p>
      </div>
    </div>

    <div id="factoid">
      <h2>Celebrity dietician Lucy Jones and Princes are working together to show families how they can eat well with canned fish.</h2>
      <p>Did you know our fillers are:</p>
      <ul>
        <li>High in protein</li>
        <li>Low in saturated fat</li>
        <li>A quick and easy lunch</li>
      </ul>
      <a href="#" class="btn">Learn More</a>
    </div>
  </div>
</div>

我在每个div周围放了一个红色边框。这是在小型或中型视口上的样子:

small viewport

> medium viewport

1 个答案:

答案 0 :(得分:0)

解决方案是取代:

@include container-fixed;

@extend .container;
container-fixed声明可以看出,

fluid-container似乎是一个流畅的容器:

.container-fluid {
  @include container-fixed;
}