Responsive in Chrome, but not on mobile - html
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
Related
text in navbar displaced on other sections of page
In certain sections of my site, the text within the navbar is a few pixels off compared to the other sections. (possible clue: section 'Austausch' and 'Mitmachen' are the two who do have the same positioning.) I've not yet been able to figure it out, but I would guess that it has something to do with me manually setting the 'top' position trough inline-css. To not clutter this page too much, you can just view the source code by inspecting the webpage here. Here's my style.css: #-webkit-keyframes blink { /* 0% { opacity: 1; } 49% { opacity: 1; } 50% { opacity: 1; } 100% { opacity: 1; } */ } .blink { /* -webkit-animation: blink 2s; -webkit-animation-iteration-count: infinite; -moz-animation: blink 1s; -moz-animation-iteration-count: infinite; -o-animation: blink 1s; -o-animation-iteration-count: infinite; */ } html { background-color: #e7d8cf; background-image: url("placeholder.png"); background-repeat: repeat; background-size: 150px; } html,body{ overflow-x: hidden; } body { margin: 0 auto; width: 100%; height: 100%; } .container { display: block; width: 30%; height: 800px; margin: 50px; text-align: center; border: none; background-color: none; } #media only screen and (max-width: 768px) { .container { width: 320px; height: 500px; } } .header { position: relative; top:100px; width: 200px; height: auto; margin-left: auto; margin-right: auto; padding: 0; } #media only screen and (max-width: 768px) { .header { width: 20%; height: 20%; } } .navbar { align-content: center; width: 500px; height: 20px; margin: 5px; padding: 10px; border: 1px solid black; box-shadow: 0 1px 0 red; background: #faf8f7; } #media only screen and (max-width: 768px) { .header { width: 20%; height: 20%; } } .box { position: relative; top: 50px; left: 50%; display: block; float: left; width: 740px; height: 420px; margin: 5px; padding: 10px; overflow-y: auto; overflow-x: hidden; border: 1px solid black; background: #faf8f7; /* box-shadow: -3px 3px 0px #000000; */ } #media only screen and (max-width: 768px) { .box { width: 300px; height: 500px; left: 20px !important; } } #media only screen and (max-width: 400px) { .box { left: -50px !important; } } .track { height:100px; background-color:none; top:-30px; box-shadow:none; border:none; position: relative; display: block; float: left; width: auto; height: auto; overflow-y: auto; overflow-x: hidden; background: #faf8f7; } #media only screen and (max-width: 768px) { .track { } } .nav { margin-top:20px !important; /* position: fixed; */ top: -960px; /* display: block; */ float: left; left: 50%; width: 400px; height: 20px; margin: 5px; padding: 10px; /* overflow-y: auto; overflow-x: hidden; */ border: 1px solid black; background: #faf8f7; box-shadow: -3px 3px 0px #000000; } #media only screen and (max-width: 768px) { .nav { width: 300px; top: -1100px; left: 21px; height: 30px !important; } } #media only screen and (max-width: 400px) { .nav { left: -50px !important; } } .minibox { position: relative; left: 20px; top: -280px; display: block; float: left; width: 260px; height: 40px; margin-top: 5px; padding-top: 10px; overflow-y: auto; overflow-x: hidden; border: 1px solid black; background: #dbdbdb; box-shadow: -3px 3px 0px #000000; display: none; } #media only screen and (max-width: 768px) { .minibox { width: 20%; height: 20%; display: none } } .subbox { position: relative; left: -11px; width: 761px; height: 330px; margin-top: -5px; padding: 0px; overflow-y: auto; overflow-x: hidden; border: 1px solid black; background: #faf8f7; } #media only screen and (max-width: 768px) { .subbox { width: 319px; height: 330px; } } .blinktext { left: calc(50% - 70px); position: relative; top:50px; width: 200px; height: auto; margin-left: auto; margin-right: auto; padding: 0; margin:0; color:white; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000,-2px 2px 0 #000; display: none; } #media only screen and (max-width: 768px) { .blinktext { display: none } } p, h2, a { font-family: "Times New Roman", Times, serif; font-size: 14px; } #media only screen and (max-width: 768px) { .minibox { font-size: 10px; width: 20%; height: 20%; } } a { /* font-family: "Lucida Console", "Courier New", monospace; */ text-decoration: none; font-weight: normal; color: black; } img { border: 1px solid black; outline-offset: -1px; } #media only screen and (max-width: 768px) { .img { width: 20px; } }
Your top position has no effect here since it's static. See here some documentation about it : MDN Web docs - top The HTML code is different from one page to another, nav element in one of the page is nested into a <small></small> HTML element, in other page it is not. So you have to make uniform you code to expect a similar behaviour.
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..
How to center align logo on WordPress?
How can I center align the logo on this header? Also wanted to know how to enable background transparency for header background color and change the value for maximum size for the logo. Here is the CSS entry for the header section. #header { display: block; position: relative; z-index: 600; /* Higher than the sidebar widget and widget container, sliders */ margin: 0; padding: 0; width: 100%; background: #2F2E3C; } #header > .inner { position: relative; } #header > .inner > .wrap { position: relative; min-height: 76px; } #media only screen and (max-width: 1024px) { #header > .inner > .warp { min-height: 80px; } } #media only screen and (max-width: 767px) { #header > .inner { text-align: center; } #header > .inner > .wrap { min-height: 40px; } } #header.sticky { position: fixed; z-index: 999; width: 100%; } #media only screen and (max-width: 767px) { #header.sticky { position: static !important; } } #header.sticky .wrap { min-height: 0; } .boxed #header.sticky { max-width: 1180px; width: 96%; } .admin-bar #header.sticky { top: 32px; } #header.sticky #site-logo { top: 10px; } #header.sticky .dropdown-menu-wrap > ul.menu > li > ul.sub-menu { top: 60px; } #header.sticky #primary-menu > ul.menu > li > a { line-height: 60px; } #header.sticky #top-header-area { display: none; } #site-logo { position: relative; display: inline-block; float: left; left: 0; top: 30px; line-height: 0; margin: 0; } #site-logo a { font-size: 28px; color: #494D4E; line-height: 36px; direction: ltr; display: block; text-align: left; /* Do not let logo get bigger than the header */ font-family: "Lato", Arial, Helvetica, Verdana, sans-serif; } #media only screen and (max-width: 767px) { #site-logo a { display: inline-block; text-align: center; } } #site-logo a img { max-height: 100%; max-width: 100%; } #media only screen and (max-width: 767px) { #site-logo { display: block; float: none; position: relative; margin: 0 auto; top: 0; padding: 10px 0; } #site-logo a img { max-width: 75%; margin: 0 auto; } } #site-description { margin: 0; } #container { background: #f7f7f7; Edit: #header { display: block; position: relative; z-index: 600; /* Higher than the sidebar widget and widget container, sliders */ margin: 0; padding: 0; width: 100%; background: #2F2E3C; } #header > .inner { position: relative; } #header > .inner > .wrap { position: relative; min-height: 76px; } #media only screen and (max-width: 1024px) { #header > .inner > .warp { min-height: 80px; } } #media only screen and (max-width: 767px) { #header > .inner { text-align: center; } #header > .inner > .wrap { min-height: 40px; } } #header.sticky { position: fixed; z-index: 999; width: 100%; } #media only screen and (max-width: 767px) { #header.sticky { position: static !important; } } #header.sticky .wrap { min-height: 0; } .boxed #header.sticky { max-width: 1180px; width: 96%; } .admin-bar #header.sticky { top: 32px; } #header.sticky #site-logo { top: 10px; } #header.sticky .dropdown-menu-wrap > ul.menu > li > ul.sub-menu { top: 60px; } #header.sticky #primary-menu > ul.menu > li > a { line-height: 60px; } #header.sticky #top-header-area { display: none; } #site-logo { position: relative; float: left; left: 0; top: 30px; line-height: 0; margin: 0; } #site-logo a { font-size: 28px; color: #494D4E; line-height: 36px; direction: ltr; display: block; text-align: left; /* Do not let logo get bigger than the header */ font-family: "Lato", Arial, Helvetica, Verdana, sans-serif; } #media only screen and (max-width: 767px) { #site-logo a { display: inline-block; text-align: center; } } #site-logo a img { margin:auto; max-height: 100%; max-width: 100%; } #media only screen and (max-width: 767px) { #site-logo { display: block; float: none; position: relative; margin: 0 auto; top: 0; padding: 10px 0; } #site-logo a img { max-width: 75%; margin: 0 auto; } } #site-description { margin: 0; } #container { background: #f7f7f7; }
Remove display: inline-block; from #site-logo then add margin:auto; to #site-logo a img. Edit: I also noticed you have float:center; in #site-logo which is not a valid property, so I would consider removing it as it is redundant.
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.
iPhone uses smallest media query
I am new to making responsive websites and from what I have discovered is that you can make a responsive website in 2 different ways, the first is by making everything fluid or like I have done, creating #media screen only and (min-width: 640px) { for a variety of window sizes (max-width: 639px, min-width: 640px, min-width: 760px, min-width: 1020px and min-width: 1280px). With each of these media queries I have designed the website to suit certain devices in mind, for example 640px is aimed for iPhone. However when uploading the website and viewing it on my iPhone the page was really messed up with scaling all wrong which lead to adding <meta name = "viewport" content = "width = device-width"> but this has lead to my website showing the smallest media query on my iPhone. I can't get the website to display properly on my iPhone with the right media query but on my laptop when I adjust the window size the website changes appropriately. What am I doing wrong? The page can be seen here, ivybridgemethodistchurch.co.uk/DEV/index.html. #media only screen and (max-width: 639px) { #wrapper { } #ne_wrapper { width: 500px; margin: 0 auto; padding-left: 20px; padding-right: 20px; padding-bottom: 20px; } .ne { width: 100%; height: 130px; overflow: auto; margin-top: 20px; background: #FFF; position: relative; } .ne img { width: 130px; margin: 0; float: left; position: absolute; z-index: 100; } #ne_tag { padding: 5px 0; margin: 0; position: absolute; z-index: 200; top: 0; left: 0; background: rgba(67, 149, 142, 0.85); } #ne_tag small { color: #FFF; margin: 0; margin-left: 20px; margin-right: 20px; padding: 0; } #ne_container { width: 330px; margin: 20px; float: right; } #ne_title { margin-bottom: 10px; } #te_wrapper { width: 500px; margin: 40px auto; padding-left: 20px; padding-right: 20px; } .te { width: 500px; height: 500px; padding: 0; position: relative; overflow: auto; } .te img { width: 100%; position: absolute; z-index: 100; } #te_container { margin: 10px; float: left; position: absolute; z-index: 200; } #te_title { float: left; padding: 15px; background: #FFF; } #te_title h1 { float: left; } #te_details { float: left; padding: 15px; background: #FFF; } #te_tag { float: left; clear: both; padding: 5px 0; margin: 0; background: rgba(67, 149, 142, 1); } #te_tag small { color: #FFF; margin: 0; margin-left: 20px; margin-right: 20px; padding: 0; } #te_description { display: none; } #pe_wrapper { width: 500px; margin: 0 auto; padding-left: 20px; padding-right: 20px; padding-bottom: 20px; } .pe { width: 100%; overflow: auto; margin-top: 10px; padding-bottom: 10px; border-bottom: 1px solid #FFF; } .pe img { width: 100px; float: left; margin-right: 10px; } #pe_container { width: 350px; overflow: auto; float: right; padding: 20px; background: #FFF; } #pe_title { padding-bottom: 10px; margin-bottom: 15px; border-bottom: 1px solid #DDD; } .no_1 { margin-top: 20px; } } #media only screen and (min-width: 640px) { #nav { width: 100%; height: 55px; background: red; border-bottom: 1px solid #DDD; position: absolute; } #outer { top: 55px; width: 100%; position: absolute; } #wrapper { } #ne_wrapper { background: purple; width: 600px; margin: 0 auto; padding-left: 20px; padding-right: 20px; padding-bottom: 20px; } .ne { width: 100%; min-height: 150px; overflow: auto; margin-top: 20px; background: #FFF; position: relative; } .ne img { width: 150px; float: left; position: absolute; z-index: 100; } #ne_container { width: 410px; margin: 20px; float: right; } #ne_title { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #DDD; } #ne_tag { padding: 5px 0; margin: 0; position: absolute; z-index: 200; top: 0; left: 0; background: rgba(67, 149, 142, 0.85); } #ne_tag small { color: #FFF; margin: 0; margin-left: 20px; margin-right: 20px; padding: 0; } #te_wrapper { width: 600px; height: auto; margin: 40px auto; padding-left: 20px; padding-right: 20px; } .te { width: 600px; height: auto; padding: 0; position: relative; overflow: auto; } .te img { width: 350px; float: left; position: relative; } #te_container { width: 250px; margin: 0; float: right; position: inherit; } #te_tag { padding: 5px 0; margin: 0; position: absolute; z-index: 200; top: 0; left: 0; background: rgb(67, 149, 142); } #te_tag small { color: #FFF; margin: 0; margin-left: 20px; margin-right: 20px; padding: 0; } #te_title { width: 220px; float: left; padding: 15px; background: rgba(255, 255, 255, 0.95); } #te_title h1 { float: left; } #te_details { width: 220px; float: left; margin-top: 1px; padding: 15px; background: rgba(255, 255, 255, 0.95); } #te_description { display: none; } #pe_wrapper { width: 600px; margin: 0 auto; padding-left: 20px; padding-right: 20px; padding-bottom: 20px; } .pe { width: 100%; overflow: auto; margin-top: 20px; background: #FFF; } .pe img { width: 120px; float: left; } #pe_title { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #DDD; } #pe_container { width: 440px; margin: 20px; float: left; } } #media only screen and (min-width: 760px) { #wrapper { } #ne_wrapper { width: 720px; } #ne_container { width: 530px; } #te_wrapper { width: 720px; margin-bottom: 20px; } .te { width: 720px; } #te_container { width: 370px; } #te_title { width: 340px; } #te_details { max-width: 340px; } #pe_wrapper { width: 720px; overflow: auto; } #st { width: 350px; float: left; } #nd { width: 350px; float: right; } .pe { width: 350px; height: 457px; position: relative; } .pe img { width: 350px; } #pe_container { width: 310px; margin: 10px; padding: 10px; height: auto; position: absolute; bottom: 0; background: #FFF; } } #media only screen and (min-width: 1020px) { #wrapper { width: 980px; margin: 0 auto; } #ne_wrapper { width: 910px; float: left; } .ne { width: 700px; background: transparent; border-left: 10px solid rgb(67, 149, 142); } #ne_inner { margin-left: 20px; } #ne_tag { display: none; } #ne_container { width: 490px; min-height: 110px; background: #FFF; padding: 20px; margin: 0; } #te_wrapper { width: 940px; } .te { width: 740px; } #te_container { width: 340px; padding: 20px; background: #FFF; } #te_title, #te_details { margin: 0; padding: 0; } #te_title { padding-bottom: 10px; border-bottom: 1px solid #DDD; } #te_details { padding-top: 10px; } #pe_wrapper { width: 940px; clear: both; } #st, #nd { width: 100%; float: left; clear: both; } .pe { width: 300px; height: 405px; float: left; background: #FFF; } .pe img { width: 300px; } #pe_container { width: 260px; } .no_1, .no_2, .no_4, .no_5 { margin-right: 20px; } } #media only screen and (min-width: 1280px) { #wrapper { width: 1120px; margin: 0 auto; overflow: auto; } #ne_wrapper { width: 1090px; margin: 0 auto; padding-left: 0; padding-right: 0; float: left; padding-bottom: 20px; } .ne { width: 730px; } #ne_container { width: 520px; } #te_wrapper { width: 1120px; } .te { width: 1120px; height: 360px; position: relative; } .te img { width: 360px; position: absolute; z-index: 100; } #te_container { width: auto; position: absolute; z-index: 200; top: 20px; left: 350px; margin: 0; padding: 0; background: transparent; } #te_tag { background: rgb(67, 149, 142); } #te_title { width: auto; max-width: 730px; overflow: auto; float: none; padding: 20px; margin: 0; margin-top: 28px; background: #FFF; border-bottom: 1px solid #F4F1EB; } #te_details { float: none; overflow: auto; padding: 20px; margin: 0; background: #FFF; border-bottom: 1px solid #F4F1EB; } #te_description { display: block; width: 730px; position: absolute; z-index: 200; margin: 0; padding: 20px; background: #FFF; } #te_description h5 { margin: 0; padding: 0; font-family: 'Roboto', sans-serif; font-weight: 300; } #pe_wrapper { width: 1120px; margin: 0 auto; clear: both; padding-left: 20px; padding-right: 20px; padding-bottom: 20px; } #st, #nd { width: 100%; float: left; clear: both; } .pe { width: 360px; height: 480px; } .pe img { width: 360px; } #pe_container { width: 300px; margin: 20px; } .no_1, .no_2, .no_4, .no_5 { margin-right: 20px; } } #media only screen and (min-width: 1360px) { }
Your media queries are not correct #media only screen and (max-width: 639px) { } #media only screen and (min-width: 640px) { } #media only screen and (min-width: 760px) { } #media only screen and (min-width: 1020px) { } #media only screen and (min-width: 1280px) { } #media only screen and (min-width: 1360px) { } This will result in applying styles of #media only screen and (max-width: 639px) { } because all other media queries are overridden by it as you have given min-width to all queries, thus it takes lowest min-width and applies it for all sizes. Change it to #media only screen and (max-width: 639px) { } #media only screen and (min-width: 640px) and (max-width: 759px) { } #media only screen and (min-width: 760px) and (max-width: 1019px) { } #media only screen and (min-width: 1020px) and (max-width: 1279px) { } #media only screen and (min-width: 1280px) and (max-width: 1359px) { } #media only screen and (min-width: 1360px) { } To explain you media queries in detail, refer css getting changed when applying css media queries for responsive design I will also put some part of that answer here for further reviews of this post. include this in <head></head> (if you have not) <meta name="viewport" content="width=device-width, user-scalable=no" /> <-- user-scalable=yes if you want user to allow zoom --> change you #media style as this // change width as per your requirements #media only screen (max-width: 500px) { // or as per your needs, as I try to explain below } Now I try to explain maybe..:) #media (max-width:500px) for a window with a max-width of 500px that you want to apply these styles. At that size you would be talking about anything smaller than a desktop screen in most cases. #media screen and (max-width:500px) for a device with a screen and a window with max-width of 500px apply the style. This is almost identical to the above except you are specifying screen as opposed to the other media types the most common other one being print. #media only screen and (max-width:500px) Here is a quote straight from W3C to explain this one. The keyword ‘only’ can also be used to hide style sheets from older user agents. User agents must process media queries starting with ‘only’ as if the ‘only’ keyword was not present. As there is no such media type as "only", the style sheet should be ignored by older browsers. Example #media all and (min-width: 500px) { } #media all and (max-width: 500px) and (min-width: 300px) { } #media all and (max-width: 299px) { }