htmlcssfluid-layoutcss-frameworks

Why is my fluid cols breaking at medium size?


I am a high school web design teacher who is currently teaching my students about how to build their own grid frameworks. I am using the floated .col method as it's easy to understand and flows well from teaching about floats and clears. I am moving onto flexbox next.

I am hitting a weird issue. At the medium size screens, and only certain sizes within that breakpoint, the grid seems to 'break' and the last .col drops to the next line. Here is a link to the JS Fiddle that shows it.

Here is the HTML

<!-- Link to Font Awesome v4 -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

<!-- Section from page that is 'breaking' at certian md sizes -->
<section id="features">
  <div class="container">
    <div class="row">
      <div class="col-lg-3 col-md-6">
        <i class="fa fa-map-marker" aria-hidden="true"></i>
        <h2>Mark Locations</h2>
        <p>Mappy lets you save important locations like home, work, or even where you parked your car!</p>
      </div>
      <div class="col-lg-3 col-md-6">
        <i class="fa fa-map" aria-hidden="true"></i>
        <h2>View Full Maps</h2>
        <p>Mappy also lets your look at up-to-date maps of towns, cities, and even the globe! </p>
      </div>
      <div class="col-lg-3 col-md-6">
        <i class="fa fa-map-signs" aria-hidden="true"></i>
        <h2>Get Directions</h2>
        <p>Let Mappy guide you where you want to go! Simply enter an address or location and Mappy will find the best route</p>
      </div>
      <div class="col-lg-3 col-md-6">
        <i class="fa fa-car" aria-hidden="true"></i>
        <h2>Realtime Traffic</h2>
        <p>Mappy is connected to local traffic updates, so it can always provide the fastest route to avoid jams</p>
      </div>

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

And the CSS

/* CUSTOM PAGE CSS*/
#features {
    padding: 20px 0;
    text-align: center;
} 
#features i.fa {
    color: #683814;
    font-size: 70px;
}
#features h2 {
    color: #DCD39E;
    margin: 15px 0;
}

/* PULLED FROM CUSTOM GRID FRAMEWORK */
* {
    box-sizing: border-box;
}
.container {
    max-width: 1000px;
    margin: auto;
    padding: 0 20px; /*Adds a tiny bit of padding so that as the container shrinks it does not touch the edge*/
}

/* ROWS */
/* Build clearfix into row */
.row::after {
    content: "";
    display: block;
    clear: both;
}
.row {
    margin: 0 -15px; /*Offset the col-* padding*/
}

/* COLS */
/*Mobile First cols*/
[class*="col-"] {
    width: 100%;
    float: left;
    padding: 10px 15px;
}

/*Col Styles For Tablets*/
@media screen and (min-width:600px) and (max-width: 992px) {
    .col-md-1 {width: 8.33%;}
    .col-md-2 {width: 16.66%;}
    .col-md-3 {width: 25%;}
    .col-md-4 {width: 33.33%;}
    .col-md-5 {width: 41.66%;}
    .col-md-6 {width: 50%;}
    .col-md-7 {width: 58.33%;}
    .col-md-8 {width: 66.66%;}
    .col-md-9 {width: 75%;}
    .col-md-10 {width: 83.33%;}
    .col-md-11 {width: 91.66%;}
    .col-md-12 {width: 100%;}

} /*end tablet*/

/*Col Styles For Desktops*/
@media screen and (min-width:993px) {
    .col-lg-1 {width: 8.33%;}
    .col-lg-2 {width: 16.66%;}
    .col-lg-3 {width: 25%;}
    .col-lg-4 {width: 33.33%;}
    .col-lg-5 {width: 41.66%;}
    .col-lg-6 {width: 50%;}
    .col-lg-7 {width: 58.33%;}
    .col-lg-8 {width: 66.66%;}
    .col-lg-9 {width: 75%;}
    .col-lg-10 {width: 83.33%;}
    .col-lg-11 {width: 91.66%;}
    .col-lg-12 {width: 100%;}
} /*End Desktop*/

Is there a class that I need to build and add to this? Or is there something that I can change about the way I have my cols built to avoid this entirely? I modeled this after Bootstrap 3.


Solution

  • It looks like this is from 'Mark Locations' copy breaking to more lines than the module next to it.

    I was able to fix this by adding a class with a min-height of 220px in the col declarations.

    .icon-height {
       min-height: 220px;
    }
    
    <div class="col-lg-3 col-md-6 icon-height">