1

I'm trying to create a bootstrap grid where every row has to columns, bootstrap has a class that does this, row-cols-*, but when I place the example on bootstrap website in a jsfiddle it doesn't break row like it is supposed to do. What am I doing wrong?

HTML:

<div class="container">
  <div class="row row-cols-2 text-white">
    <div class="col border bg-primary">Column</div>
    <div class="col border bg-primary">Column</div>
    <div class="col border bg-primary">Column</div>
    <div class="col border bg-primary">Column</div>
  </div>
</div>
Hugo Persson
  • 33
  • 1
  • 6

2 Answers2

4

The .row-cols-* class is new to Bootstrap 4.4: https://github.com/twbs/bootstrap/releases. Your problem might be due to the fact that you're referencing the prior version of Bootstrap. At least your jsfiddle was doing that.

Reference the correct Bootstrap 4.4 files fixes the issue:

enter image description here

demo: https://jsfiddle.net/davidliang2008/1Ltc9zos/1/

enter image description here

David Liang
  • 20,385
  • 6
  • 44
  • 70
0

External resources in JSFiddle (Adding Twitter Bootstrap CDN)

The logic is the same as when you set it up in an editor, like Brackets.

Try this:

<div class="container">
  <div class="row row-cols-2">
    <div class="col">Column</div>
    <div class="col">Column</div>
  </div>
  <div class="row row-cols-2">
    <div class="col">Column</div>
    <div class="col">Column</div>
  </div>
</div>