【问题标题】:Bootstrap rows overlapping with each other自举行相互重叠
【发布时间】:2016-02-19 18:49:04
【问题描述】:

当我缩小浏览器窗口时,我网站的第一部分在移动设备上的显示效果很差。

我正在使用引导程序,但我一生都无法弄清楚为什么会发生这种情况。

本质上:我的 h1 标题没有缩小,然后我的 h2 副标题覆盖在 greenpromobox div 的顶部,该 div 本身被下一行覆盖!

现场示例: http://185.123.96.102/~kidsdrum/moneynest.co.uk/(调整浏览器窗口大小以查看响应不佳的布局)。

不良样式部分的 HTML:

<div class="special">
<div class="jumbotron">
  <div class="container text-center">
    <div class="h1extrapadding hidden-xs hidden-sm"></div>  <h1 class="boldme">Aged 20-30 & frustrated with money?</h1> 
    <div class="greenpromobox">
    <div class="h2extrapadding hidden-xs hidden-sm"></div>  <h2 class="boldme">Take our free <b class="jumpstarttext">Jumpstart Your Finances</b> class to<br /> quickly gain control over your finances</h2>


            <!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="//moneynest.us11.list-manage.com/subscribe/post?u=9ccf2d2219536b32eaae3c3d1&amp;id=299de51b4e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
    <div id="mc_embed_signup_scroll">


                   <img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/hand-drawn-arrow.png" id="handarrow" class="hidden-xs hidden-sm" alt="arrow"><input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="Enter your email address" required autofocus>
    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
    <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_9ccf2d2219536b32eaae3c3d1_299de51b4e" tabindex="-1" value=""></div>
    <div class="clear"><input type="submit" value="Start Class Now" name="subscribe" id="mc-embedded-subscribe" class="text-uppercase btn btn-primary btn-lg"></div>
    </div>
</form>
</div>

<!--End mc_embed_signup-->

</div>
</div>

 </div>
</div>
  </div>

<div class="container-fluid bg-3 text-center">    
  <h3 class="h3big">What do you need help with?</h3><br>
  <div class="row">
    <div class="col-sm-4">
         <img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/button-1.png" alt="button-1">
         <div class="box-content">
                       <p class="alltextbig text-uppercase"><b>Living</b> paycheque to paycheque?</p>
                       <figure><img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/pound-coins.jpg" alt="saving money image" title="Saving money" class="tripleimage">
                       <figcaption>Lesson 1 - Learn how to stop the pay cheque to pay cheque cycle.</figcaption>

                       </figure>


<input type="submit" value="Start Class Now" name="subscribe" id="mc-embedded-subscribe" class="text-uppercase btn btn-primary btn-lg btn-middle" style="margin-top: 9%">

              </div>
              </div>
    <div class="col-sm-4 columnBorder"> 

       <img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/button-2.png" alt="button-1">
       <div class="box-content column-border">
           <p class="alltextbig text-uppercase"><b>Saving</b> to buy a home?</p>
           <figure>
             <img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/saving-to-buy-a-home.jpg" alt="Buying a house" title="Saving to buy a house" class="tripleimage"><figcaption>
             Lesson 2 - Tips to rapidly save for your future home.
             </figcaption>
             </figure>

           <input type="submit" value="Start Class Now" name="subscribe" id="mc-embedded-subscribe" class="text-uppercase btn btn-primary btn-lg btn-middle" style="margin-top: 9%">
      </div>
      </div>
    <div class="col-sm-4"> 
       <img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/button-3.png" alt="button-1">
       <div class="box-content">
      <p class="alltextbig text-uppercase"><b>Going</b> travelling?</p>
      <figure>
        <img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/going-travelling.jpg" alt="Travelling" title="Travelling"  class="tripleimage">
        <figcaption>Lesson 3 - How I personally travelled for 13 months with only £2,000 (yes I had a roof over my head every night!).
        </figcaption>
        </figure>

    <input type="submit" value="Start Class Now" name="subscribe" id="mc-embedded-subscribe" class="text-uppercase btn btn-primary btn-lg btn-middle">

    </div>
    </div>
  </div>
</div><br>

【问题讨论】:

    标签: html css twitter-bootstrap


    【解决方案1】:

    您需要在图片上加上max-width: 100%;。这将停止重叠,但仍可在较大的屏幕尺寸上保持响应。

    我还会将您的边界从.column-border 移到.columnBorder。这样空间会更好。

    img { 
      max-width: 100%; 
    }
    .columnBorder {
      border-left: 1px solid #ccc;
      border-right: 1px solid #ccc;
    }
    

    【讨论】:

      【解决方案2】:

      请更新这个类。您的重叠问题将得到修复

      .special, .special .jumbotron {
        height: auto;
        overflow: hidden;
        width: 100%;
      }
      

      【讨论】:

      • 这在解决方案中效果最好,但隐藏了 greenpromobox div,并且在调整大小时也隐藏了一半的 h1 标题。知道为什么吗?
      【解决方案3】:

      我不知道这对你的情况是否有帮助,但我在 bootstrap v5.3.1 两个连续的行重叠时遇到了类似的问题

      代码不工作

      <div class="row">
          <h1> content </h1>
      </div>
      <div class="row">
          <p> whatever </p>
      </div>
      

      我敲击了另一个 div 中的第二行,即父级,它起作用了

      解决方案

      <div class="row">
          <h1> content </h1></div>
      <div class="parent>
      <div class="row">
          <p> whatever </p>
      </div></div>
      

      我不知道这是否真的是问题,你不能连续有两行 div,但我希望它有帮助

      【讨论】:

        猜你喜欢
        • 2020-12-08
        • 1970-01-01
        • 1970-01-01
        • 2013-04-02
        • 2019-03-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多