Skip to content

Instantly share code, notes, and snippets.

@yangli-io
Created November 11, 2015 08:34
Show Gist options
  • Select an option

  • Save yangli-io/4265a46e6a188e1b5b3a to your computer and use it in GitHub Desktop.

Select an option

Save yangli-io/4265a46e6a188e1b5b3a to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</body>
</html>
html, body{
height: 100%;
}
.box{
height: 200px;
border: 1px solid black;
float: left;
margin: 1%;
}
.container{
margin: 0 auto;
border: 1px solid black;
height: 100%;
}
@media screen and (max-width: 479px){
.container{
width: 80%;
}
.box{
width: 98%;
}
}
@media screen and (min-width: 480px){
.container{
width: 80%;
}
.box{
width: 98%;
}
}
@media screen and (min-width: 768px){
.container{
width: 700px;
}
.box {
width: 47%;
}
}
@media screen and (min-width: 1200px){
.container{
width: 1000px;
}
.box{
width: 31%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment