Gubian
Gubian

Reputation: 80

Css grid goes wrong

I tried to do some grid in css, but something went wrong here, and I didn't understand what I do wrong, follow my jsFiddle with the code

jsFiddle

/*Grid*/
.container {
  width: 100%;
  max-width: 1200px;
}
.row:before,
.row:after {
  content: "";
  display: table;
  clear: both;
}
[class*='col-'] {
  float: left;
  min-height: 1px;
  width: 8.3333%;
  padding: 15px; /*Gutter*/
}
.col-lg-1 {width: 8.3333%;}
.col-lg-2 {width: 16.6666%;}
.col-lg-3 {width: 25%;}
.col-lg-4 {width: 33.3333%;}
.col-lg-5 {width: 41.6666%;}
.col-lg-6 {width: 50%;}
.col-lg-7 {width: 58.3333%;}
.col-lg-8 {width: 66.6666%;}
.col-lg-9 {width: 75%;}
.col-lg-10 {width: 83.3333%;}
.col-lg-11 {width: 91.6666%;}
.col-lg-12 {width: 100%;}

Someone could help with this?

Upvotes: 1

Views: 61

Answers (1)

G-Cyrillus
G-Cyrillus

Reputation: 106058

what you are missing is box-sizing:border-box;

https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing

demo: https://jsfiddle.net/6h7ka51k/3/

Upvotes: 1

Related Questions