<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Grid</title>
<style type="text/css">
body {
margin: 0px;
}
#container {
width: 100%;
background-color: #033;
overflow: auto;
}
#container .grid {
display: inline;
float: left;
height: 240px;
background-color: #0F6;
min-width: 240px;
max-width: 320px;
width: 25%; /* Starting at 25% as this would create 4 across on popular screen resolutions */
}
#container #grid1 {
background-color: #c42;
}
#container #grid2 {
background-color: #3C6;
}
#container #grid3 {
background-color: #CC6;
}
#container #grid4 {
background-color: #993;
}
#container #grid5 {
background-color: #633;
}
#container #grid6 {
background-color: #C96;
}
</style>
</head>
<body>
<div id="container">
<div class="grid" id="grid1"> </div>
<div class="grid" id="grid2"> </div>
<div class="grid" id="grid3"> </div>
<div class="grid" id="grid4"> </div>
<div class="grid" id="grid5"> </div>
<div class="grid" id="grid6"> </div>
</div>
</body>
</html>
ASKER
HTML (HyperText Markup Language) is the main markup language for creating web pages and other information to be displayed in a web browser, providing both the structure and content for what is sent from a web server through the use of tags. The current implementation of the HTML specification is HTML5.
TRUSTED BY
As the screen goes smaller, you want to use a lower min width and height. You can have 3 or 4 media queries.
@media (max-width: 600px) {
#container .grid {
/* display: inline; this should be a block */
float: left;
height: 240px; /* change for each size */
background-color: #0F6;
min-width: 240px; /* change for each size */
max-width: 320px; /* change for each size */
width: 25%; /* Starting at 25% as this would create 4 across on popular screen resolutions */
}
}