Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

css - Bootstrap grid columns not stacking

Working on a Bigcartel store with some simple Bootstrap elements. I've worked with Bootstrap many times, and the columns are stacking correctly on the rest of the site, but not on this particular page. Here's the code:

<div class="container-fluid team" id="merchpreview" style="background-color: #3ED500">
  <div class="row">
    <div class="col-xs-12 text-center">
      <h1 style="Font-family: Nunito; color: #F1F2F2;"><b><u>MERCH INFO</b></u></h1>
    </div>
  </div>
     <div class="row">
       <div class="col-xs-3">
              <a href="{{ product.image | product_image_url }}" >
                {% if product.on_sale %}<div id="sale"><span class="onsale">On Sale</span></div>{% endif %}
                  {% case product.status %}{% when 'sold-out' %}<div id="sold"><span class="soldout">Sold Out</span></div>{% endcase %}
              <img src="{{ product.image | product_image_url }}" alt="Image of {{ product.name | escape }}" style="margin-bottom: 5em;" />
               </a>

    </div>


    <div class="col-xs-7" style="color: #F1F2F2;">
    <div id="product-details" class="span5">
        <h3 class="name" style=" font-family: 'Muli', sans-serif;"><span>{{ product.name }}</span></h3>
          <h3 class="price" style=" font-family: 'Muli', sans-serif;">{% if product.max_price != product.default_price %}<del>{{ product.max_price | money_with_sign }}</del>{% endif %}<span>{{ product.price | money_with_sign }}</span></h3>
          <h3 style=" font-family: 'Muli', sans-serif;"><b>Product features:</b></h3>
          <ul>
            {{ product.description }}
          </ul>
        </div>

So as the screen size gets smaller, the text is overlapping the image, instead of stacking the columns which is Bootstrap's default behavior. Not sure why this isn't working. To my knowledge, the row/col are nested correctly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The col-xs-* columns don't stack. Use col-sm-* instead.

Codeply demo

Note: Bootstrap 4 col-xs-* has been changed to just col-*.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...