I am trying to learn responsive design. I am building a website and one of the pages is a portfolio. I set up the following mockup of how I would lay out this page. it is a very stripped down version of course. I cannot seem to apply the proper queries so that this format would look ok on a widescreen desktop, an ipad and lets say a mobile phone. I started the 1st query but it isnt working of course and also know if that is the best size for a common widescreen desktop.
Can anybody get me started on how to apply that to this page? Im going to continue on tutorials but need a kick start here.
<!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>Untitled Document</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<style type="text/css">
@media screen and (max-width:1080px) {
#main {
width: 960px;
}
}
body {
background-color: #FFF;
margin:0;
}
#main {
width: 1080px;
margin-right: auto;
margin-left: auto;
height: 860px;
margin-top: 20px;
margin-bottom: 20px;
}
.box {
background-color: #CCC;
height: 200px;
width: 200px;
margin-right: 20px;
float: left;
margin-bottom: 20px;
}
.box_last {
background-color: #CCC;
height: 200px;
width: 200px;
float: left;
margin-bottom:20px;
}
.box_bottom {
background-color: #CCC;
height: 200px;
width: 200px;
margin-right: 20px;
float: left;
}
.box_last_bottom {
background-color: #CCC;
height: 200px;
width: 200px;
float: left;
}
</style>
</head>
<body>
<div id="main">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box_last"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box_last"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box_last"></div>
<div class="box_bottom"></div>
<div class="box_bottom"></div>
<div class="box_bottom"></div>
<div class="box_bottom"></div>
<div class="box_last_bottom"></div>
</div>
</body>
</html>
In your current code the
#mainfrom the media query block is getting overwritten. You have to put your media queries at the very bottom of your CSSAnd then for a smaller screen