jweinst1
4/1/2017 - 5:54 AM

grid layout in html

grid layout in html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>repl.it</title>
    <link href="index.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <style>
      * {
    box-sizing: border-box;
}

.row::after {
    content: "";
    clear: both;
    display: table;
}
[class*="col-"] {
    float: left;
    padding: 15px;
    border: 1px solid red;
}
.col-1 {width: 8.33%;}
.col-2 {width: 16.66%;}
.col-3 {width: 25%;}
.col-4 {width: 33.33%;}
.col-5 {width: 41.66%;}
.col-6 {width: 50%;}
.col-7 {width: 58.33%;}
.col-8 {width: 66.66%;}
.col-9 {width: 75%;}
.col-10 {width: 83.33%;}
.col-11 {width: 91.66%;}
.col-12 {width: 100%;}
    </style>
  <div class="row">
    <div class="col-5">
      <p>This is a div.</p>
    </div>
    <div class="col-5">
      <p>This is a div.</p>
    </div>
    <div class="col-2">
      <p>Side</p>
    </div>
  </div>
  <div class="row">
    <div class="col-8">
      <p>This is a div.</p>
    </div>
  </div>
    <script src="index.js"></script>
  </body>
</html>