CSS - stop layout from changing - html

I have a grid of images that are generated on the screen. The amount of images in a row on the grid depends on the size of the page. It all works well until the page gets too small, then the layout goes off.
This is the proper layout.
This is what happens when the page gets too small.
CSS:
.g {
padding: 0.25em;
overflow: hidden;
}
.g li {
float: left;
width: 50%;
padding: 10px;
padding-left: 10px;
border: 2px solid black;
background: #fff;
background-repeat: repeat;
background-size: cover;
}
.g img {
max-width: 100%
display: block;
}
#media screen and (min-width: 55em) {
.g li {
width: 25%;
}
.g li:nth-child(4n+1) {
clear: left;
}
.g li:nth-child(3n+1) {
clear: none;
}
}
#media screen and (min-width: 72em) {
.g li {
width: 20%;
}
.g li:nth-child(5n+1) {
clear: left;
}
.g li:nth-child(4n+1) {
clear: none;
}
}
Could I make it so if the page got small than the 4x4 grid, that grid still stayed, rather than it changing?

Change your CSS to:
.g {
padding: 0.25em;
overflow: hidden;
}
.g li {
float: left;
width: 20%;
padding: 10px;
padding-left: 10px;
border: 2px solid black;
background: #fff;
background-repeat: repeat;
background-size: cover;
}
.g img {
max-width: 100%
display: block;
}
.g li:nth-child(5n+1) {
clear: left;
}
.g li:nth-child(4n+1) {
clear: none;
}
EDIT:
Simply remove the first media wrap.
.g {
padding: 0.25em;
overflow: hidden;
}
.g li {
float: left;
width: 50%;
padding: 10px;
padding-left: 10px;
border: 2px solid black;
background: #fff;
background-repeat: repeat;
background-size: cover;
}
.g img {
max-width: 100%
display: block;
}
.g li {
width: 25%;
}
.g li:nth-child(4n+1) {
clear: left;
}
.g li:nth-child(3n+1) {
clear: none;
}
#media screen and (min-width: 72em) {
.g li {
width: 20%;
}
.g li:nth-child(5n+1) {
clear: left;
}
.g li:nth-child(4n+1) {
clear: none;
}
}

Related

display:none not correctly working on mobile

there ho here's a CSS code, I want to hide it on PC view but visible on Phone view, I'm able to achieve my results on PC, but not on Phone, because display: none; is interfering with the code's work. Can anyone please check it?
/* --------- Game-section-mobile---------*/
* {
transition: all .155s ease-in-out;
}
.event-link {
margin: 300px 0 0 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
text-decoration: none;
}
.event-h3 {
margin-top: 30px;
}
.events {
display: flex;
flex-wrap: wrap;
display: none;
}
.events .shadowbox {
height: 100vh;
padding-top: 0;
background: rgba(0, 0, 0, 0.5);
}
.event {
text-align: center;
margin-top: 0;
min-width: 100px;
background-repeat: no-repeat;
}
.event .event-h3 {
padding-top: 50px;
}
.event {
background-size: cover;
background-position: center;
height: 100vh;
flex-grow: 1;
flex-basis: 0;
text-align: center;
min-width: 100px;
background-repeat: no-repeat;
}
.event:hover {
flex-grow: 2;
}
.events .shadowbox:hover {
background: rgba(0, 0, 0, 0.76);
}
.event .event-h3,
.event p {
color: white;
width: 90%;
margin: auto;
}
.event:not(:first-of-type) {
border-left: 1px solid white;
}
.shadowbox img{
margin-top: 50%;
height: 200px;
}
#media only screen and (max-width: 775px) {
.event:last-of-type {
margin-bottom: 10px;
}
.event:hover {
flex-grow: 1;
}
.event:nth-of-type(1) {
max-width: 100%;
}
.event {
min-width: 300px;
margin-bottom: 3px;
}
.shadowbox img{
margin-top: 50%;
height: 150px;
}
}
#media only screen and (max-width: 775px){
.events{
display: block;
}
}
You have a second media query for .events. So when your screen width is smaller than 775px, your .events will get displayed again. Which is the case on a mobile view. Delete or comment it out, and it should work.
#media only screen and (max-width: 775px){
.events{
display: block;
}
}

My media query does not work well and i do not know what i did wrong. It worked sometime ago but not anymore

My media query does not work well and i do not know what i did wrong. It worked sometime ago but not anymore. I am targeting larger screen sizes (1920 x 1080), (1680 x 1080) but some how it works for certain pages but not on others. I am confused as to what to do. It only renders for #media (min-width: 768px) and i do not know what to do. Here is the code.
#media only screen and (min-width: 1600px) {
/* for about page */
.team-back1 {
height: 690px;
background-position: 10% center;
}
.team-right-content {
margin-top: 2%;
}
/* for service page */
.team-back {
height: 690px;
background-position: center 20%;
}
.col-sm-7 {
width: 58.333333%;
margin-top: -1%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 69%;
}
/* for home page */
#home-2 .container-fluid {
height: 690px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 650px;
margin-top: 3.5%;
}
/*for project page */
.pc {
height: 550px;
float: right;
}
.team-back3 {
height: 690px;
background-position: center 20%;
}
/* width: 73%; */
margin-top: 0%;
}
/* for contact page */
/*#contact-us .container-fluid {
height: 760px;}
.contct-lft-bck {
height: 580px !important;}
#map {
height: 580px;}
.contct-middle-back {
height: 580px;}
.contct-right-back {
height: 580px; }*/
/*.row {
margin-top: 3.5%; }*/
}
#media only screen and (min-width: 1680px) {
/* for about page */
.team-right-content p {
font-size: 16px;
}
.team-back1 {
height: 798px;
background-position: 10% center;
}
.team-right-content {
margin-top: 3%;
}
/* for service page */
.team-back {
height: 798px;
background-position: center -35%;
}
.col-sm-7 {
width: 60.333333%;
margin-top: 2%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 76%;
}
/* for home page */
#home-2 .container-fluid {
height: 798px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 680px;
margin-top: 3.5%;
}
/*for project page */
.pc {
height: 580px;
float: right;
}
.team-back3 {
height: 798px;
background-position: center -35%;
}
/* for contact page */
#contact-us .container-fluid {
height: 798px;
}
.contct-lft-bck {
height: 680px !important;
}
#map {
height: 680px;
}
.contct-middle-back {
height: 680px;
}
.contct-right-back {
height: 680px;
}
.row {
margin-top: 3.5%;
}
}
#media only screen and (min-width: 1800px) {
.team-right-content p {
font-size: 16px;
}
/* for projects*/
.team-back3 {
height: 760px;
background-position: 30% center;
}
.project-content {
height: 512px;
}
.bret {
width: 970px;
margin-left: 40px;
}
.project-height {
height: 512px;
margin-top: -4%;
}
/* for about page */
.team-back1 {
height: 760px;
background-position: 10% 20%;
}
.team-right-content {
margin-top: -4%;
}
/* for service page */
.team-back {
height: 760px;
/* background-position: center -40%; */
background-position: 5% -10%;
}
.col-sm-7 {
width: 60.333333%;
margin-top: 4%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 89%;
}
/* for home page */
#home-2 .container-fluid {
height: 760px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 700px;
margin-top: 3.5%;
}
/*for project page */
.pc {
/* height: 600px; */
overflow-y: auto;
/* float: right;} */
/* for contact page */
#contact-us .container-fluid {
height: 760px;
}
#contact-us .container-fluid {
height: 760px;
}
.contct-lft-bck {
height: 685px !important;
}
#map {
height: 685px;
}
.contct-right-back {
height: 685px;
}
.row {
margin-top: 3.5%;
}
.contt {
height: 760px!important;
}
}
}
#media only screen and (max-width:1140px) {
#blog-1 .col-sm-4 {
width: 50%;
}
}
#media only screen and (max-width:1100px) {
.hidden-xs {
display: none!important;
}
}
#media only screen and (max-width:1000px) {
}
#media only screen and (max-width:992px) {
.top-cart {
display: none;
}
.nav-menu ul {
margin-right: 50px;
}
#team .col-sm-offset-5 {
margin-left: 0%;
}
#team .col-sm-7 {
width: 100%;
}
.single-left {
width: 100%!important;
}
.single-left .reply-form-left-col {
width: 100%!important;
}
.single-right {
width: 100%;
}
.cell-2 {
width: 50%;
}
.cell-3 {
width: 50%;
}
}
#media only screen and (max-width:840px) {
.footer-left {
width: 100%;
clear: both;
}
.footer-left p {
text-align: center;
}
.footer-right {
width: 100%;
text-align: center;
}
#blog-1 .col-sm-4 {
width: 80%;
}
#blog-1 .row {
margin: 0 auto;
}
.left-15 {
padding-left: 15px;
}
#contact-us .col-sm-4 {
width: 100%;
}
}
#media only screen and (max-width:767px) {
.bou {
height: 620px;
}
.nav-menu {
display: none;
}
.morphsearch {
display: none;
}
.mobile-drop {
display: block;
}
.extra {
top: 18px!important;
}
#blog-1 .col-sm-4 {
width: 100%;
}
#blog-1 .row {
margin: 0 auto;
}
#blog-single-1 .single-post-detail-image img {
min-width: 100%;
}
#blog-single-1 .blog-item {
padding: 15px;
}
.home-bottom {
font-size: 8px!important;
padding: 7px 12px!important;
}
.btn-group-lg>.btn,
.btn-lg {
line-height: 1.3333333;
margin-right: -80px;
margin-top: 25px;
float: right;
}
.btn-group-md>.btn,
.btn-md {
line-height: 1.3333333;
margin-right: -30px;
margin-top: 25px;
float: right;
display: none;
}
#team .container-fluid {
padding: 50px 10px 10px 10px;
}
.team-back {
height: 100% !important;
}
.team-back1 {
height: 100% !important;
}
.abouty {
padding: 0px;
margin-right: 0px;
}
.team-right-content {
padding: 20px 25px 20px 10px;
}
.project-content {
padding: 20px;
}
.pc {
padding-left: 70px;
}
.serve {
display: none !important;
}
/*.meetus {
visibility: hidden;
}*/
.bighead {
display: none;
}
.bighead2 {
display: none;
}
.righty {
float: left;
}
}
#media only screen and (max-width:640px) {
.home-bottom {
font-size: 5px!important;
padding: 7px 12px!important;
}
.team-right-content .member-content {
text-align: center;
margin: auto;
margin-bottom: 25px;
}
.team-right-content .member-content img {
text-align: center;
margin: auto;
}
.footer-left p {
margin-left: 0px!important;
}
}
#media only screen and (max-width:580px) {
.cell-2 {
width: 100%;
}
.home-2-icon {
padding-top: 40px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 250px;
}
.cell-3 {
width: 100%;
}
.home3-content-container {
top: 40px;
}
[class*="cell-3"],
.masonry .post-item {
min-height: 250px;
}
}
#media only screen and (max-width:480px) {
.about2-left {
padding: 21px 20px;
}
.about-two-link {
padding-bottom: 80px;
}
}
#media only screen and (max-width:420px) {
.left-post-content {
width: 80%;
padding-bottom: 20px;
}
.left-post-back {
margin-bottom: 20px;
}
.right-post-content {
width: 80%;
padding-bottom: 20px;
}
.right-post-image {
float: left;
}
.right-post-back {
margin-bottom: 20px;
}
}
#media only screen and (min-width:220px) and (max-width:480px) {
}
#media only screen and (min-width:767px) {
.mobile-modal {
display: none;
}
.mob-head {
display: none;
}
.mob-subhead {
display: none;
}
}
#media (min-width: 768px) {
.col-sm-offset-5 {
margin-left: 33.666667%;
}
/*.col-sm-7 {
width: 67.333333%;
} */
.bouts {
width: 58%;
}
.bret {
width: 750px;
}
.pc {
height: 490px;
}
.row {
margin-top: 0%;
}
.team-back1 {
height: 548px;
}
.team-back {
height: 548px;
}
.contct-lft-bck {
height: 548px!important;
}
.contct-middle-back {
height: 548px;
}
.contct-right-back {
height: 548px;
}
#contact-us .container-fluid {
height: 548px;
}
}
#media (min-width: 1200px) {
.cmine {
width: 1024px;
}
}
Probably i am not placing the media query code in accordance or something. I just need an insight. Here is the website link of the actual page CLICK TO OPEN
I think it has something to do with the ordering of your media query css. so why don't you try to order them like below. So your code becomes more user friendly as well:
#media only screen and (max-width:420px) {
.left-post-content {
width: 80%;
padding-bottom: 20px;
}
.left-post-back {
margin-bottom: 20px;
}
.right-post-content {
width: 80%;
padding-bottom: 20px;
}
.right-post-image {
float: left;
}
.right-post-back {
margin-bottom: 20px;
}
}
#media only screen and (max-width:480px) {
.about2-left {
padding: 21px 20px;
}
.about-two-link {
padding-bottom: 80px;
}
}
#media only screen and (max-width:580px) {
.cell-2 {
width: 100%;
}
.home-2-icon {
padding-top: 40px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 250px;
}
.cell-3 {
width: 100%;
}
.home3-content-container {
top: 40px;
}
[class*="cell-3"],
.masonry .post-item {
min-height: 250px;
}
}
#media only screen and (max-width:640px) {
.home-bottom {
font-size: 5px!important;
padding: 7px 12px!important;
}
.team-right-content .member-content {
text-align: center;
margin: auto;
margin-bottom: 25px;
}
.team-right-content .member-content img {
text-align: center;
margin: auto;
}
.footer-left p {
margin-left: 0px!important;
}
}
#media only screen and (max-width:767px) {
.bou {
height: 620px;
}
.nav-menu {
display: none;
}
.morphsearch {
display: none;
}
.mobile-drop {
display: block;
}
.extra {
top: 18px!important;
}
#blog-1 .col-sm-4 {
width: 100%;
}
#blog-1 .row {
margin: 0 auto;
}
#blog-single-1 .single-post-detail-image img {
min-width: 100%;
}
#blog-single-1 .blog-item {
padding: 15px;
}
.home-bottom {
font-size: 8px!important;
padding: 7px 12px!important;
}
.btn-group-lg>.btn,
.btn-lg {
line-height: 1.3333333;
margin-right: -80px;
margin-top: 25px;
float: right;
}
.btn-group-md>.btn,
.btn-md {
line-height: 1.3333333;
margin-right: -30px;
margin-top: 25px;
float: right;
display: none;
}
#team .container-fluid {
padding: 50px 10px 10px 10px;
}
.team-back {
height: 100% !important;
}
.team-back1 {
height: 100% !important;
}
.abouty {
padding: 0px;
margin-right: 0px;
}
.team-right-content {
padding: 20px 25px 20px 10px;
}
.project-content {
padding: 20px;
}
.pc {
padding-left: 70px;
}
.serve {
display: none !important;
}
/*.meetus {
visibility: hidden;
}*/
.bighead {
display: none;
}
.bighead2 {
display: none;
}
.righty {
float: left;
}
}
#media only screen and (min-width:767px) {
.mobile-modal {
display: none;
}
.mob-head {
display: none;
}
.mob-subhead {
display: none;
}
}
#media (min-width: 768px) {
.col-sm-offset-5 {
margin-left: 33.666667%;
}
/*.col-sm-7 {
width: 67.333333%;
} */
.bouts {
width: 58%;
}
.bret {
width: 750px;
}
.pc {
height: 490px;
}
.row {
margin-top: 0%;
}
.team-back1 {
height: 548px;
}
.team-back {
height: 548px;
}
.contct-lft-bck {
height: 548px!important;
}
.contct-middle-back {
height: 548px;
}
.contct-right-back {
height: 548px;
}
#contact-us .container-fluid {
height: 548px;
}
}
#media only screen and (max-width:840px) {
.footer-left {
width: 100%;
clear: both;
}
.footer-left p {
text-align: center;
}
.footer-right {
width: 100%;
text-align: center;
}
#blog-1 .col-sm-4 {
width: 80%;
}
#blog-1 .row {
margin: 0 auto;
}
.left-15 {
padding-left: 15px;
}
#contact-us .col-sm-4 {
width: 100%;
}
}
#media only screen and (max-width:992px) {
.top-cart {
display: none;
}
.nav-menu ul {
margin-right: 50px;
}
#team .col-sm-offset-5 {
margin-left: 0%;
}
#team .col-sm-7 {
width: 100%;
}
.single-left {
width: 100%!important;
}
.single-left .reply-form-left-col {
width: 100%!important;
}
.single-right {
width: 100%;
}
.cell-2 {
width: 50%;
}
.cell-3 {
width: 50%;
}
}
#media only screen and (max-width:1140px) {
#blog-1 .col-sm-4 {
width: 50%;
}
}
#media only screen and (max-width:1100px) {
.hidden-xs {
display: none!important;
}
}
#media (min-width: 1200px) {
.cmine {
width: 1024px;
}
}
#media only screen and (min-width: 1600px) {
/* for about page */
.team-back1 {
height: 690px;
background-position: 10% center;
}
.team-right-content {
margin-top: 2%;
}
/* for service page */
.team-back {
height: 690px;
background-position: center 20%;
}
.col-sm-7 {
width: 58.333333%;
margin-top: -1%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 69%;
}
/* for home page */
#home-2 .container-fluid {
height: 690px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 650px;
margin-top: 3.5%;
}
/*for project page */
.pc {
height: 550px;
float: right;
}
.team-back3 {
height: 690px;
background-position: center 20%;
}
}
#media only screen and (min-width: 1680px) {
/* for about page */
.team-right-content p {
font-size: 16px;
}
.team-back1 {
height: 798px;
background-position: 10% center;
}
.team-right-content {
margin-top: 3%;
}
/* for service page */
.team-back {
height: 798px;
background-position: center -35%;
}
.col-sm-7 {
width: 60.333333%;
margin-top: 2%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 76%;
}
/* for home page */
#home-2 .container-fluid {
height: 798px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 680px;
margin-top: 3.5%;
}
/*for project page */
.pc {
height: 580px;
float: right;
}
.team-back3 {
height: 798px;
background-position: center -35%;
}
/* for contact page */
#contact-us .container-fluid {
height: 798px;
}
.contct-lft-bck {
height: 680px !important;
}
#map {
height: 680px;
}
.contct-middle-back {
height: 680px;
}
.contct-right-back {
height: 680px;
}
.row {
margin-top: 3.5%;
}
}
#media only screen and (min-width: 1800px) {
.team-right-content p {
font-size: 16px;
}
/* for projects*/
.team-back3 {
height: 760px;
background-position: 30% center;
}
.project-content {
height: 512px;
}
.bret {
width: 970px;
margin-left: 40px;
}
.project-height {
height: 512px;
margin-top: -4%;
}
/* for about page */
.team-back1 {
height: 760px;
background-position: 10% 20%;
}
.team-right-content {
margin-top: -4%;
}
/* for service page */
.team-back {
height: 760px;
/* background-position: center -40%; */
background-position: 5% -10%;
}
.col-sm-7 {
width: 60.333333%;
margin-top: 4%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 89%;
}
/* for home page */
#home-2 .container-fluid {
height: 760px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 700px;
margin-top: 3.5%;
}
/*for project page */
.pc {
/* height: 600px; */
overflow-y: auto;
/* float: right;} */
/* for contact page */
#contact-us .container-fluid {
height: 760px;
}
#contact-us .container-fluid {
height: 760px;
}
.contct-lft-bck {
height: 685px !important;
}
#map {
height: 685px;
}
.contct-right-back {
height: 685px;
}
.row {
margin-top: 3.5%;
}
.contt {
height: 760px!important;
}
}
Also you had some left over curly brackets and some random styles. Also check every line of code properly there might be some errors in some lines involving brackets.
You have some issues with the closing of the queries and also some of the tags...
The some queries are "double closed", there is an additional } before the #media only screen and (min-width: 1680px) and #media only screen and (max-width:1140px) query.
Secondary within #media only screen and (min-width: 1800px) your .pc isn't closed.
A decent validator or even editor should have noticed this..

Body wider than 100% only on mobile

I've looked everywhere for a reasonable answer to this, but I can't find it. I have a relatively simple responsive website and it works fine on every screen, except for below 768px. For some reason, the body gets stretched and I get some horizontal scrolling, despite everything being set to 100%. The body is the only portion that appears to be wider than the viewport. I have a typical reset stylesheet to clear all padding and margins. I didn't forget to set meta name="viewport" tags or initial-scale. I honestly have no idea what is going on. The layout is fine on a tablet. It is even correct if I turn my phone to landscape. It's only in portrait that the body gets stretched about 15px outside the viewport and I have some horizontal scrolling. There is just blank white space on the right. You can check out the link on your phone to see the issue firsthand. Any ideas on how to fix this?
The layout is pretty simple
<body>
<div data-ng-include="'app/layout/shell.html'">
</div>
</body>
Here's the shell
<header class="fixed-header-shell" data-ng-include="'app/layout/topnav.html'"></header>
<div class="sections-shell" data-ng-view></div>
<footer class="footer-shell" data-ng-include="'app/layout/footer.html'"></footer>
All of the shell's are set to 100% width and have no right or left padding. Here is the entire page css for reference.
#import "colors";
#import "fonts";
#import "reset";
#import "init";
/***********************
Variables
************************/
/*Header*/
#defaultHeaderHeight: 110px;
#defaultNavHeight: 50px;
#defaultHeaderPadding: #defaultHeaderHeight/2 - #defaultNavHeight/2;
#defaultHeaderSidePadding: 5.0%;
/*Footer*/
#defaultFooterHeight: 70px;
/*Section*/
#defaultSectionPadding: 60px;
//#defaultSidePadding: 5.0%;
#defaultSidePadding: 0px;
#defaultSectionHeaderMargin: 35px;
#mediumSidePadding: 2.5%;
#smallSidePadding: 1.5%;
#sectionShellWidth: 100%;
#defaultSectionWidth: 55%;
/***********************
Mixins
************************/
.Clickable
{
&:hover
{
text-decoration:none;
cursor: pointer;
color: #primaryAccent;
}
&:visited
{
text-decoration:none;
}
&:active
{
text-decoration:none;
}
&:link
{
text-decoration:none;
}
}
.Button
{
padding: 8px;
background-color: #divider;
color: #primaryDark;
border-style: solid;
border-radius: 3px;
}
.Image(#imageURL, #radius, #size)
{
background-image: url(#imageURL);
-webkit-border-radius:#radius;
-moz-border-radius:#radius;
border-radius:#radius;
background-position: center;
background-size: #size #size;
width: #size;
height: #size;
}
/***********************
Body
************************/
body
{
background-color: #primaryBackground;
width: 100%;
}
/***********************
Shells
************************/
.fixed-header-shell
{
width: 100%;
position: fixed;
top: 0px;
z-index: 10;
background-color: #primaryBackgroundDark;
}
.sections-shell
{
width: 100%;
margin-top: #defaultHeaderHeight;
min-height: 900px;
background-color: #primaryBackground;
}
.footer-shell
{
width: 100%;
background-color: #primaryBackgroundDark;
}
/***********************
Blocks
************************/
.fixed-header-block
{
background-color: #primaryBackgroundDark;
height: #defaultHeaderHeight;
clear: both;
width: 100%;
//padding-left: #defaultHeaderSidePadding;
//padding-right: #defaultHeaderSidePadding;
}
.section-block
{
background-color: #primaryBackground;
width: #defaultSectionWidth;
padding-top: #defaultSectionPadding;
padding-bottom: #defaultSectionPadding;
margin-right: auto;
margin-left: auto;
text-align: left;
border-style: solid;
border-bottom-width: 1.5px;
border-bottom-color: #divider;
}
.footer-block
{
background-color: #primaryBackgroundDark;
text-align: center;
padding-top: #defaultSectionPadding;
padding-bottom: #defaultSectionPadding;
height: #defaultFooterHeight;
}
/***********************
Header
************************/
.fixed-header-logo
{
.HeadingLogo;
.Clickable;
height: #defaultHeaderHeight;
line-height: #defaultHeaderHeight;
//margin-left: #defaultHeaderSidePadding;
text-align: left;
color: #white;
}
.fixed-header-nav
{
height: #defaultHeaderHeight;
//margin-right: #defaultHeaderSidePadding;
text-align: right;
}
.fixed-header-nav-link
{
.Clickable;
.HeadingLink;
line-height: #defaultHeaderHeight;
margin-left: 18px;
//margin-right: 9px;
color: #white;
}
/***********************
Footer
************************/
.footer-link
{
.Clickable;
text-align: center;
.fa
{
.Clickable;
color: #secondaryTextWhite;
width: 5em;
line-height: #defaultFooterHeight / 2;
}
}
.footer-text
{
.FooterText;
color: #secondaryTextWhite;
margin: auto;
line-height: #defaultFooterHeight / 2;
width: 24em;
}
/***********************
Sections
************************/
.section-block-text
{
.BodyText;
color: #text;
margin-top: #defaultSectionHeaderMargin;
}
.section-header
{
.SectionHeader;
text-align: left;
color: #text;
}
.section-sub-header
{
.SectionSubHeader;
margin-top: #defaultSectionHeaderMargin / 2;
color: #text;
}
/***********************
Columns
************************/
.col
{
display: block;
float:left;
margin: 0 0 0 0;
}
.span_2_of_2
{
width: 100%;
}
.span_1_of_2
{
width: 50%;
}
/***********************
Grouping
************************/
.group:before,
.group:after
{
content:"";
display:table;
}
.group:after
{
clear:both;
}
.group
{
zoom:1; /* For IE 6/7 */
width: 95%;
margin: auto;
}
/***********************
Intro
************************/
#intro
{
background-color: #primaryBackgroundDark;
text-align: center;
.section-block
{
border-style: none;
background-color: #primaryBackgroundDark;
}
}
#intro-avatar
{
.Image("../../content/images/profile2.png", 9999px, 200px);
margin: auto;
}
#intro-tagline
{
.HeadingTagline;
color: #white;
margin-top: 75px;
margin-left: auto;
margin-right: auto;
text-align: center;
}
/***********************
Posts
************************/
#details
{
border-style: none;
}
.post-link
{
.Clickable;
}
.post-date
{
text-align: left;
color: #secondaryText;
.PostDate
}
.post-title
{
.PostTitle;
.Clickable;
margin-top: 5px;
text-align: left;
color: #text;
}
.post-full-title
{
.PostTitle;
margin-top: 5px;
text-align: left;
color: #text;
}
.post-text
{
.BodyText;
margin-top: 5px;
text-align: left;
color: #text;
}
.post-full-text
{
.BodyText;
margin-top: 5px;
padding-bottom: 50px;
text-align: left;
color: #text;
border-style: solid;
border-bottom-width: 1.5px;
border-bottom-color: #divider;
}
.post-navigation
{
.Clickable;
.Button;
.BodyText;
display: inline-block;
margin-top: 50px;
}
/***********************
Projects
************************/
.project-section
{
text-align: left;
}
.project-title
{
.PostTitle;
margin-top: 5px;
text-align: left;
color: #text;
}
.project-text
{
.BodyText;
margin-top: 15px;
text-align: left;
color: #text;
}
.project-image
{
width: 100%;
//height: 450px;
border-color: #primaryLight;
border-width: 2px;
border-style: solid;
object-fit: contain;
object-position: center;
}
.project-link
{
.Clickable;
}
/***********************
Contact
************************/
#contact
{
.fa
{
color:#primaryAccent;
margin-right: 10px;
width: 24px;
}
}
/***********************
Links
************************/
#links
{
background-color: #primaryBackgroundOff;
h3
{
color:#primaryDark;
}
a
{
.Clickable;
color: #primaryDark;
text-align: center;
}
#facebook
{
.Image("../../content/images/facebook.png", 9999px, 75px);
margin: auto;
}
#linkedin
{
.Image("../../content/images/linkedin.png", 9999px, 75px);
margin: auto;
}
#google
{
.Image("../../content/images/google.png", 9999px, 75px);
margin: auto;
}
#github
{
.Image("../../content/images/github.png", 9999px, 75px);
margin: auto;
}
}
.resume-link
{
margin-top: 1.5em;
.Clickable;
.Button;
.BodyText;
display: inline-block;
}
/***********************
Media Queries
************************/
#media screen and (max-width: 1024px)
{
.fixed-header-block
{
//padding-right: #mediumSidePadding;
//padding-left: #mediumSidePadding;
}
.section-block
{
//padding-right: #mediumSidePadding;
//padding-left: #mediumSidePadding;
width: 70%;
}
}
#media screen and (max-width: 800px)
{
.fixed-header-shell
{
position: relative;
}
.fixed-header-nav
{
text-align: center;
height: #defaultHeaderHeight / 3;
}
.fixed-header-nav-link
{
line-height: #defaultHeaderHeight / 3;
margin-left: 15px;
margin-right: 15px;
}
.fixed-header-logo
{
text-align: center;
line-height: #defaultHeaderHeight * 2 / 3;
height: #defaultHeaderHeight * 2 / 3;
}
.fixed-header-block
{
//padding-right: #smallSidePadding;
//padding-left: #smallSidePadding;
}
.sections-shell
{
margin-top: 0;
}
.section-block
{
//padding-right: #smallSidePadding;
//padding-left: #smallSidePadding;
width: 90%;
}
.col
{
margin: 0 0 0 0%;
}
.span_2_of_2,
.span_1_of_2,
{
width: 100%;
}
#intro-tagline
{
font-size: 3.4em;
}
}
#media screen and (max-width: 480px)
{
#intro-tagline
{
font-size: 3em;
}
}
You have a fixed width of 24em on your .footer-text
Remove that and you will be good.

Responsive in Chrome, but not on mobile

I am using WP-skeleton, and modifing it to fit into my website. However, my website is currently only responsive in Chrome on my PC, and not on my phone.
The divs are changing the size Chrome, e.g the pictures on front page (class imagebox) are 420px when screen size is 48px, and 300px when screen size is 960px. On my phone everything is like the base 960px grid all the time, and does not resizes after the current screen size.
Could you guys help me out?
/*
Theme Name: WP-Skeleton
Theme URI: https://github.com/wycks/WP-Skeleton-Theme
Author: Wycks
Author URI: wpsecure.net
Description: Responsive Bare Bones framework based on Dave Gamache's getskeleton.com
Version: 1.0
License: http://www.opensource.org/licenses/mit-license.php.
Tags: Responsive, grid, mobile, framework, bare-bones, white, minimal
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
/* Table of Contents
==================================================
#Base 960 Grid
#Tablet (Portrait)
#Mobile (Portrait)
#Mobile (Landscape)
#Clearing */
/* #Base 960 Grid
================================================== */
.container { position: relative; width: 960px; margin: 0 auto; padding: 0; }
.column, .columns { float: left; display: inline; margin-left: 10px; margin-right: 10px; }
.row { margin-bottom: 20px; }
/* Nested Column Classes */
.column.alpha, .columns.alpha { margin-left: 0; }
.column.omega, .columns.omega { margin-right: 0; }
/* Base Grid */
.container .one.column { width: 40px; }
.container .two.columns { width: 100px; }
.container .three.columns { width: 160px; }
.container .four.columns { width: 220px; }
.container .five.columns { width: 280px; }
.container .imagebox.columns { width: 300px; margin-left: 30px; margin-top: 30px;}
.container .six.columns { width: 340px; }
.container .seven.columns { width: 400px; }
.container .eight.columns { width: 460px; }
.container .nine.columns { width: 520px; }
.container .ten.columns { width: 580px; }
.container .eleven.columns { width: 640px; }
.container .twelve.columns { width: 700px; }
.container .thirteen.columns { width: 760px; }
.container .fourteen.columns { width: 820px; }
.container .fifteen.columns { width: 880px; }
.container .sixteen.columns { width: 940px; }
.container .one-third.column { width: 300px; }
.container .two-thirds.column { width: 620px; }
/* Offsets */
.container .offset-by-one { padding-left: 60px; }
.container .offset-by-two { padding-left: 120px; }
.container .offset-by-three { padding-left: 180px; }
.container .offset-by-four { padding-left: 240px; }
.container .offset-by-five { padding-left: 300px; }
.container .offset-by-six { padding-left: 360px; }
.container .offset-by-seven { padding-left: 420px; }
.container .offset-by-eight { padding-left: 480px; }
.container .offset-by-nine { padding-left: 540px; }
.container .offset-by-ten { padding-left: 600px; }
.container .offset-by-eleven { padding-left: 660px; }
.container .offset-by-twelve { padding-left: 720px; }
.container .offset-by-thirteen { padding-left: 780px; }
.container .offset-by-fourteen { padding-left: 840px; }
.container .offset-by-fifteen { padding-left: 900px; }
/* #Tablet (Portrait)
================================================== */
/* Note: Design for a width of 768px */
#media only screen and (min-width: 768px) and (max-width: 959px) {
.container { width: 768px; }
.container .column,
.container .columns { margin-left: 10px; margin-right: 10px; }
.column.alpha, .columns.alpha { margin-left: 0; margin-right: 10px; }
.column.omega, .columns.omega { margin-right: 0; margin-left: 10px; }
.container .one.column { width: 28px; }
.container .two.columns { width: 76px; }
.container .three.columns { width: 124px; }
.container .four.columns { width: 172px; }
.container .five.columns { width: 220px; }
.container .imagebox.columns { width: 240px; margin-left: 23px; margin-top: 23px; }
.container .six.columns { width: 268px; }
.container .seven.columns { width: 316px; }
.container .eight.columns { width: 364px; }
.container .nine.columns { width: 412px; }
.container .ten.columns { width: 460px; }
.container .eleven.columns { width: 508px; }
.container .twelve.columns { width: 556px; }
.container .thirteen.columns { width: 604px; }
.container .fourteen.columns { width: 652px; }
.container .fifteen.columns { width: 700px; }
.container .sixteen.columns { width: 748px; }
.container .one-third.column { width: 236px; }
.container .two-thirds.column { width: 492px; }
/* Offsets */
.container .offset-by-one { padding-left: 48px; }
.container .offset-by-two { padding-left: 96px; }
.container .offset-by-three { padding-left: 144px; }
.container .offset-by-four { padding-left: 192px; }
.container .offset-by-five { padding-left: 240px; }
.container .offset-by-six { padding-left: 288px; }
.container .offset-by-seven { padding-left: 336px; }
.container .offset-by-eight { padding-left: 348px; }
.container .offset-by-nine { padding-left: 432px; }
.container .offset-by-ten { padding-left: 480px; }
.container .offset-by-eleven { padding-left: 528px; }
.container .offset-by-twelve { padding-left: 576px; }
.container .offset-by-thirteen { padding-left: 624px; }
.container .offset-by-fourteen { padding-left: 672px; }
.container .offset-by-fifteen { padding-left: 720px; }
}
/* #Mobile (Portrait)
================================================== */
/* Note: Design for a width of 320px */
#media only screen and (max-width: 767px) {
.container { width: 300px; }
.columns, .column { margin: 0 10px; }
.container .one.column,
.container .two.columns,
.container .three.columns,
.container .four.columns,
.container .five.columns,
.container .six.columns,
.container .seven.columns,
.container .eight.columns,
.container .nine.columns,
.container .ten.columns,
.container .eleven.columns,
.container .twelve.columns,
.container .thirteen.columns,
.container .fourteen.columns,
.container .fifteen.columns,
.container .sixteen.columns,
.container .one-third.column,
.container .two-thirds.column { width: 280px; }
.container .imagebox.columns { width: 300px; margin-left: 0px; margin-top: 5px; clear: both;}
/* Offsets */
.container .offset-by-one,
.container .offset-by-two,
.container .offset-by-three,
.container .offset-by-four,
.container .offset-by-five,
.container .offset-by-six,
.container .offset-by-seven,
.container .offset-by-eight,
.container .offset-by-nine,
.container .offset-by-ten,
.container .offset-by-eleven,
.container .offset-by-twelve,
.container .offset-by-thirteen,
.container .offset-by-fourteen,
.container .offset-by-fifteen { padding-left: 0; }
/* Float menu left now*/
.menu ul {float:left;}
}
/* #Mobile (Landscape)
================================================== */
/* Note: Design for a width of 480px */
#media only screen and (min-width: 480px) and (max-width: 767px) {
.container { width: 420px; }
.columns, .column { margin: 0 10px; }
.container .one.column,
.container .two.columns,
.container .three.columns,
.container .four.columns,
.container .five.columns,
.container .six.columns,
.container .seven.columns,
.container .eight.columns,
.container .nine.columns,
.container .ten.columns,
.container .eleven.columns,
.container .twelve.columns,
.container .thirteen.columns,
.container .fourteen.columns,
.container .fifteen.columns,
.container .sixteen.columns,
.container .one-third.column,
.container .two-thirds.column { width: 400px; }
.container .imagebox.columns {width: 420px; margin-top: 10px; clear: both;}
/* Float menu left now*/
.menu ul {float:left;}
}
/* #Clearing
================================================== */
/* Self Clearing Goodness */
.container:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; }
/* Use clearfix class on parent to clear nested columns,
or wrap each row of columns in a <div class="row"> */
.clearfix:before,
.clearfix:after,
.row:before,
.row:after {
content: '\0020';
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0; }
.row:after,
.clearfix:after {
clear: both; }
.row,
.clearfix {
zoom: 1; }
/* You can also use a <br class="clear" /> to clear columns */
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
img.scale-with-grid {
max-width: 100%;
height: auto; }
/* #Base NAV 960 Grid
================================================== */
nav {
padding-top: 10px;
text-align:center;
margin: 0 auto;
}
nav ul {
display: inline;
list-style-type: none;
padding-left: 0px;
}
nav li {
display: inline;
padding-left: 55px;
padding-right: 55px;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
text-transform: uppercase;
font-weight: 300;
}
nav li a:hover {
color:#808080;
-webkit-transition: all 0.3s ease-in-out;
}
nav li a {
color: #282828;
text-decoration: none;
font-size: medium;
}
.nav-button { display: none; }
.logoo { display: none; }
}
#media only screen and (min-width: 768px) and (max-width: 959px) {
nav li {
padding-left: 20px;
padding-right: 20px;
}
}
#media only screen and (min-width: 0px) and (max-width: 767px) {
/* Navigation Button
-------------------------------------------------------- */
nav ul img {
display: none;
}
.logoo {
display: inline;
width: 150px;
margin-top: 0px;
margin: 0 auto;
}
.nav-button {
display: block;
position: absolute;
top: 7px;
left: 7px;
width: 50px;
height: 35px;
background: url('../images/menu-icon-large.png'), -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background: url('../images/menu-icon-large.png'), -moz-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background: url('../images/menu-icon-large.png'), -ms-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background: url('../images/menu-icon-large.png'), -o-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background-position: center center;
background-repeat: no-repeat;
background-size: 21px, 100%;
cursor: pointer;
border: 0 none;
border-bottom: 1px solid rgba(255,255,255,.1);
box-shadow: 0 0 4px rgba(0,0,0,.7) inset;
border-radius: 5px;
z-index: 999;
text-indent: -9999px;
}
.nav-button:hover {
background-color: rgba(0,0,0,.1);
}
.nav-button.open {
background: url('../images/close-icon-large.png'), -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background: url('../images/close-icon-large.png'), -moz-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background: url('../images/close-icon-large.png'), -ms-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background: url('../images/close-icon-large.png'), -o-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background-position: center center;
background-repeat: no-repeat;
background-size: 21px, 100%;
}
/* Navigation Bar
-------------------------------------------------------- */
body { padding-top: 50px; }
nav {
width: 100%;
float: none;
background-color: #b0b0b0; /* change the menu color */
background-image: -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background-image: -moz-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background-image: -ms-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
background-image: -o-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.2));
display: block;
height: 50px;
margin: 0;
padding: 0;
overflow: hidden;
box-shadow: 0 1px 2px rgba(0,0,0,.6);
position: absolute;
left: 0px;
z-index: 998;
clear: both;
}
nav li {
display: none;
width: 100%;
}
nav li a {
display: block;
width: 90%;
padding: 10px 5%;
font-size: 14px;
font-weight: bold;
text-shadow: -1px -1px 0 rgba(0,0,0,.15);
color: white;
text-decoration: none;
border-bottom: 1px solid rgba(0,0,0,.2);
border-top: 1px solid rgba(255,255,255,.1);
}
nav li a:hover {
background-color: rgba(0,0,0,.5);
border-top-color: transparent;
}
nav > li:first-child {
border-top: 1px solid rgba(0,0,0,.2);
}
/* Toggle the navigation bar open */
nav.open {
height: auto;
padding-top: 50px;
}
nav.open li {
display: block;
}
/* Submenus – optional .parent class indicates dropdowns */
nav > li:hover > a {
background: rgba(0,0,0,.5);
border-bottom-color: transparent;
}
nav li.parent > a:after {
content: "▼";
color: rgba(255,255,255,.5);
float: right;
}
nav li.parent > a:hover {
background: rgba(0,0,0,.75);
}
nav li ul {
display: none;
background: rgba(0,0,0,.5);
border-top: 0 none;
padding: 0;
}
nav li ul a {
border: 0 none;
font-size: 12px;
padding: 10px 5%;
font-weight: normal;
}
nav li:hover ul {
display: block;
border-top: 0 none;
}
}
Make sure you add the viewport meta tag. At the bare minimum, you'll need the following:
<meta name="viewport" content="width=device-width">
Additional options are available as well. Check the reference link below for more information.
Reference: Mozilla Developer Network - Viewport Meta Tag

Can't get the CSS nth term to work

I realise i have posted couple of questions on floating , nearly near just have one more question on the nth term..
I am trying to adjust some responsive floats using the nth term and widths but im struggling to change the following.
When you reduce the screen size to under 600px i need the two boxes to be displayed as 3 equally boxes, not two. I am struggling to accomplish this using widths and use of nth term.
Im trying to achieve the following.
4 boxes above 900px +px
3 boxes above 600px - 900px
2 boxes 460px - 600px
1 box 0- 460px
If anyone could help it would be great.
http://jsfiddle.net/sFApC/
.display-box{
position: relative;
clear: left;
background: #fff;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.09);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.09);
box-shadow: 0 1px 2px rgba(0,0,0,0.09);
padding: 10px 10px 30px 10px;
border: 1px solid #d1d1d1;
}
.display-box:hover{
-webkit-box-shadow: 0 10px 6px -6px #b5b5b5;
-moz-box-shadow: 0 10px 6px -6px #b5b5b5;
box-shadow: -1px 1px 11px 2px #b5b5b5;
cursor: pointer;
border: 1px solid #c6c6c6 ;
}
.display-user{
max-width: 20px !important;
margin-bottom: 10px;
float: left;
}
.user-name{
float: left;
font-weight: bold;
margin: 6px 0 0 6px;
}
.content-upload img{
height: 20%;
}
#upload-container {
width: 100%;
max-width: 970px;
margin: 0 auto;
margin-top: 20px;
}
#upload-container ul {
width: 100%;
*zoom: 1;
}
#upload-container ul li {
float: left;
margin-right: -100%;
width: 93%;
}
#upload-container ul li a:hover {
text-decoration: none;
}
#upload-container ul li span {
font-size: 16px;
line-height: 22px;
display: block;
padding-bottom: 30px;
}
#upload-container ul li img {
width: 100%;
}
#upload-container ul li:nth-child(1n+1) {
margin-left: 0%;
margin-bottom: 5.85%;
clear: both;
overflow: hidden;
*zoom: 1;
}
#media screen and (min-width: 460px) {
#upload-container ul li {
float: left;
margin-right: -100%;
width: 42.08%;
}
#upload-container ul li span {
padding-bottom: 10px;
}
#upload-container ul li:nth-child(2n+1) {
margin-left: 0%;
margin-bottom: 3.85%;
clear: both;
overflow: hidden;
*zoom: 1;
}
#upload-container ul li:nth-child(2n+2) {
margin-left: 51.93%;
margin-bottom: 3.85%;
clear: none;
}
}
#media screen and (min-width: 600px) {
#upload-container ul li {
float: left;
margin-right: -100%;
width: 45.08%;
}
#upload-container ul li span {
padding-bottom: 10px;
}
#upload-container ul li:nth-child(2n+1) {
margin-left: 0%;
margin-bottom: 3.85%;
clear: both;
overflow: hidden;
*zoom: 1;
}
#upload-container ul li:nth-child(2n+2) {
margin-left: 51.93%;
margin-bottom: 3.85%;
clear: none;
}
}
#media screen and (min-width: 900px) {
#upload-container ul li {
float: left;
margin-right: -100%;
width: 20.8%;
}
#upload-container ul li span {
padding-bottom: 0px;
}
#upload-container ul li:nth-child(4n+1) {
margin-left: 0%;
margin-bottom: 3.85%;
clear: both;
overflow: hidden;
*zoom: 1;
}
#upload-container ul li:nth-child(4n+2) {
margin-left: 25.96%;
margin-bottom: 3.85%;
clear: none;
}
#upload-container ul li:nth-child(4n+3) {
margin-left: 51.93%;
margin-bottom: 3.85%;
clear: none;
}
#upload-container ul li:nth-child(4n+4) {
margin-left: 77.89%;
margin-bottom: 3.85%;
clear: none;
}
}
In #media screen and (min-width: 600px) query you have only 2 columns specified.
Quick fix:
#media screen and (min-width: 600px) {
#upload-container ul li {
float: left;
margin-right: -100%;
width: 27.73%;
}
#upload-container ul li span {
padding-bottom: 10px;
}
#upload-container ul li:nth-child(3n+1) {
margin-left: 0%;
margin-bottom: 3.85%;
clear: both;
overflow: hidden;
*zoom: 1;
}
#upload-container ul li:nth-child(3n+2) {
margin-left: 34.29%;
margin-bottom: 3.85%;
clear: none;
}
#upload-container ul li:nth-child(3n+3) {
margin-left: 68.59%;
margin-bottom: 3.85%;
clear: none;
}
}
This is not pixel-perfect, but you can see 3 columns. You must just adjust margins and widths.
Working sample: http://jsfiddle.net/Ls8c6/1/
Your css is incorrect, you are using the same thing for media screen with min-width:460 and media screen with min-width: 600.
Try to change your code, use this snippet for media screen and min-width of 600px:
#media screen and (min-width: 600px) {
#upload-container ul li {
float: left;
margin-right: -100%;
width: 25.8%;
background-color: green;
}
#upload-container ul li span {
padding-bottom: 0px;
}
#upload-container ul li:nth-child(3n+1) {
margin-left: 0%;
margin-bottom: 3.85%;
clear: both;
overflow: hidden;
*zoom: 1;
}
#upload-container ul li:nth-child(3n+2) {
margin-left: 30.96%;
margin-bottom: 3.85%;
clear: none;
}
#upload-container ul li:nth-child(3n+3) {
margin-left: 61.93%;
margin-bottom: 3.85%;
clear: none;
}
}
I would rather skip the #media queries and just use float: left on .display-box. Together with a width: 200px, you would get roughly the expected behaviour.
.display-box {
float: left;
width: 200px;
}
This would need some margin and padding adjustments, of course. See modified JSFiddle
If you want exactly the given columns, I would still use float: left, but simplify the media queries to just give a relative width for .display-box and refactor the rest into the common CSS rules
.display-box {
float: left;
min-width: 200px;
width: 80%;
}
#media screen and (min-width: 460px) {
.display-box {
width: 40%;
}
}
#media screen and (min-width: 600px) {
.display-box {
width: 25%;
}
}
#media screen and (min-width: 900px) {
.display-box {
width: 17%;
}
}
JSFiddle