Skip to content

Instantly share code, notes, and snippets.

@mohammed-io
Created January 28, 2019 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mohammed-io/99b317d7c6fefb4fc9fb7f486c99b675 to your computer and use it in GitHub Desktop.
Save mohammed-io/99b317d7c6fefb4fc9fb7f486c99b675 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body {
margin: 0;
}
.box:nth-child(1) {
background-color: red;
}
.box:nth-child(2) {
background-color: #0f5fff;
}
.box:nth-child(3) {
background-color: #f54fe2;
}
.box {
background-color: #ae1224;
margin: -1.99px;
}
.container [class*=col-] {
display: inline-block;
}
@media print {
/* Only apply if it's a printer */
.box {
color: pink;
}
}
@media screen and (min-width: 600px) {
/* Only apply if screen and mid-width= 600px */
.col-md-4 {
width: 33.33333333%;
}
}
@media screen and (max-width: 599px) {
.col-sm-1 {
width: 16.66666666667%;
}
.col-sm-2 {
width: 33.3333333333%;
}
}
</style>
</head>
<body>
<div class="container">
<div class="box col-md-4 col-sm-6">1</div>
<div class="box col-md-4 col-sm-6">2</div>
<div class="box col-md-4 col-sm-6">3</div>
<div class="box col-md-4 col-sm-6">4</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment