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) {
}
Related
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. 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..
After researching this topic a bit, I've found that this is a fairly common question to ask, but a solution varies depending on the theme. I contact my theme's developers, but have not received a response.
I've looked through my theme's CSS and haven't been able to find how or where to get rid of this white space gap between the body content and my footer.
Here is a screenshot of the issue. (Please note: this is a screenshot of a preview; it isn't actually live). My website is: https://dental.keystoneindustries.com/
Is there a line of CSS I need to edit/remove/add? If so, where? CSS posted below.
#languageSelector {
display: none;
}
/*Language selector*/
div#all-site-wrapper.hfeed.site div.OneLinkShow.OneLinkKeepLinks {
position: absolute;
width: 100%;
left: auto;
right: auto;
z-index: 100000;
}
div#all-site-wrapper.hfeed.site div.OneLinkShow.OneLinkKeepLinks p {
max-width: 1170px;
width: auto;
padding: 15px 15px 0;
margin-left: auto;
margin-right: auto;
}
.wpr_hazzard_img {
width: auto !important;
display: block;
}
.wpr_hazzard_img_inline {
width: auto !important;
display: inline-block !important;
}
.wpr_message_box {
display: inline-block;
margin: 0 1em 1em 0;
padding: 0 20px;
vertical-align: top;
background: #fff none repeat scroll 0 0;
border: 3px solid black;
border-radius: 0;
color: black;
}
.group_table .woocommerce .quantity, .woocommerce-page .quantity{
width: 50px !important;
display: inline-block;
float: left !important;
}
.group_table .wpr_tooltip_js{
display: inline-block;
margin-top: 10px;
vertical-align: middle;
}
#all-site-wrapper .iv-layout.header .login-ajax .trigger {
font-size: 13px;
}
.header-right-area {
margin-top:12px;
}
.live-search .iv-layout.header .inner-form {
padding: 14px;
}
.live-search {
position: relative;
}
.live-search .trigger {
display: none;
}
.live-search .inner-wrapper {
visibility: visible;
opacity: 1;
position: static;
}
#all-site-wrapper .live-search:not(.search-top-style):not(.search-full-screen- alt-style):not(.search-full-screen-style) .inner-wrapper:after,
#all-site-wrapper .live-search:not(.search-top-style):not(.search-full-screen- alt-style):not(.search-full-screen-style) .inner-wrapper:before {
display: none;
}
.live-search .inner-wrapper {
width: 260px;
border: 0 none;
}
#all-site-wrapper .live-search .inner-form {
padding: 0;
}
.classic-right-area .wpr-fix .iv-module {
margin-left: 10px;
}
#media (max-width: 1200px) {
.classic-right-area {
min-height: 200px;
}
.classic-right-area .header-right-area {
position: relative;
}
#all-site-wrapper .classic-right-area .wpr-fix .iv-module {
padding-bottom: 20px;
}
#all-site-wrapper .wpr-fix {
width: auto;
}
#all-site-wrapper .login-ajax {
margin-top: 10px;
}
#all-site-wrapper .woo-cart {
margin-top: 4px;
}
}
#media (max-width: 992px) {
#all-site-wrapper .wpr-fix .iv-module {
display: block;
}
#all-site-wrapper .wpr-fix {
position: relative;
width: 100%;
}
#all-site-wrapper .login-ajax .inner-wrapper {
left: 0;
}
#all-site-wrapper .login-ajax .inner-wrapper:before {
left: 31px;
}
#all-site-wrapper .login-ajax .inner-wrapper:after {
left: 32px;
}
#all-site-wrapper .classic-right-area .custom-text {
display: none !important;
}
#all-site-wrapper .wpr-fix .live-search {
position: absolute;
top: 0;
left: 20px;
margin-left: 0;
}
}
#media (max-width: 767px) {
.wpr-spacer {
height: 130px;
width: 100%;
float: left;
}
#all-site-wrapper .wpr-fix .live-search {
margin: 0 auto !important;
position: static;
float: none;
}
#all-site-wrapper .wpr-fix .login-ajax {
position: absolute;
top: 20px;
left: 25%;
width: 200px;
}
#all-site-wrapper .wpr-fix .woo-cart {
position: absolute;
left: 41%;
top: 20px;
width: 250px;
}
#all-site-wrapper .logo img {
margin-top: 0px;
}
#all-site-wrapper .header-left-area {
display: inline-block;
float: none;
position: relative;
left: 24%;
}
#all-site-wrapper .header-left-area .logo {
margin: 35px 0 0px;
}
#all-site-wrapper .live-search .inner-form {
margin-top: -46px;
}
}
#media (max-width: 600px) {
#all-site-wrapper .wpr-fix .login-ajax {
left: 22%;
}
}
#media (max-width: 478px) {
#all-site-wrapper .wpr-fix .login-ajax {
left: 0;
width: 80px;
}
#all-site-wrapper .wpr-fix .woo-cart {
left: 24%;
width: auto;
}
#all-site-wrapper .classic-right-area .wpr-fix .iv-module.live-search {
padding-bottom: 0;
position: absolute;
right: 15px;
bottom: 15%;
left: auto;
top: auto;
}
.live-search .inner-wrapper {
width: 170px;
border: 0 none;
}
.wpr-spacer {
height: 80px;
width: 100%;
float: left;
}
.wpr-fix {
margin-top: 0;
}
div#all-site-wrapper.hfeed.site div.OneLinkShow.OneLinkKeepLinks p {
margin-bottom: 10px;
padding: 15px;
}
#all-site-wrapper .header-left-area .logo {
margin: 5px 0 0;
}
.classic-right-area .menu-area-wrapper {
border-top: 0;
border-bottom: 0;
position: absolute;
top: 0;
right: 0;
}
.classic-right-area {
min-height: 130px;
}
.classic-right-area.stuck {
min-height: inherit;
}
.classic-right-area.stuck .container {
display: block !important;
}
.classic-right-area.stuck .container .header-left-area .logo {
margin: 15px auto !important;
}
.classic-right-area.stuck .container .header-left-area .logo .logo-normal {
margin: 0 auto;
}
.classic-right-area.stuck .container .wpr-fix {
display: none;
}
}
Any help would be much appreciated!
You have elements with the class .ivan-custom-wrapper which have a margin-bottom: 45px; which is causing the white space. Either remove that margin completely or change it to a margin-top and then zero out the margin on the first instance of that element.
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.
I am working on a mobile responsive website.
I have the navigation menu with the fixed position.
Right after I close the nav-menus div I have an image that has to be right under it. The thing is that the image goes under the fixed div of the menu.
What is the solution for this?
I want the yellow banner to be fully visible under the nav bar. now it's just under + behind it.
This is an example of what I have :
HTML code:
<!DOCTYPE html>
<html >
<body style="height:100%;">
<div data-role="panel" id="menu" class="" style="padding: 45px 0; margin: 0; " >
<div class="ui-panel-inner">
// the main menu in the background
</div>
</div>
<div id="superDiv" style="background-color: white; -webkit-transition: width 2s; transition: width 2s; height: 130%; ">
<div class="main" style="height: 100%;">
<div class="sidebar">
// menu items
</div>
<div class="header_space"></div> // I used this but it's now working good with precentages..
<img src="banner.png" id="mob-banner"/> // this is the banner
<div class="dynamicPage">
// content of the page..
</div>
</div>
</div>
</body>
</html>
The CSS code:
/******************/
/*** MOBILE ******/
/****************/
.header_space{
display: none;
height: 5.1%;
}
#mob-menu-btn{
display: none;
}
.sub-menu{
display: none;
}
#mob-home-btn{
display: none;
}
#mob-logo{
display: none;
}
#mob-banner{
display: none;
}
.makeFixed{
position: fixed;
}
/*****************************************************************/
#media (max-width: 604px) {
.main{
width: 100%;
/*overflow: hidden;*/
overflow-x: hidden;
}
.sidebar{
float: initial;
width: 100%;
padding: 0;
position: fixed;
z-index: 100;
background-image: url('top_background.png');
text-decoration: none;
}
.header_space{
display: inherit;
height: 4.7%;
}
.sports{
/*display: none;*/
padding: 0 ;
background-color: #fff;
margin: 0;
width:100%;
}
.list{
width: 100%;
overflow: hidden;
overflow-y: auto;
top: -10%;
overflow: hidden;
overflow-y: auto;
height: 880%;
display: none;
}
.sports li{
list-style-image:none;
list-style-type: none;
border-bottom: 2px solid #eeeeee;
margin-bottom: 0px;
margin-left: 0px;
/*padding-top: 15px;
padding-bottom: 15px;*/
padding-left: 10px;
width:100%;
font-family: arial;
text-decoration: none;
overflow: hidden;
/*height: 27px;*/
z-index: 100;
}
.sports a li {
text-decoration: none;
}
.sports2{
display: none;
margin-bottom: 0;
overflow: hidden;
}
.sub-menu{
display: inherit;
float: left;
cursor: pointer;
width: 30px;
/*margin-right: 20px;*/
position: relative;
bottom: 7px;
z-index: 900;
position: relative;
top: 7px;
padding-right: 17px;
}
.sports2 li{
list-style-image:none;
list-style-type: none;
border-bottom: 0px solid #eeeeee;
margin-bottom: 0px;
margin-left: 0px;
/*padding-top: 15px;
padding-bottom: 15px;*/
padding-left: 0px;
width:100%;
font-family: "arial";
text-decoration: none;
overflow: hidden;
}
.sports2 div{
padding: 15px 0;
}
#mob-menu-btn{
float: right;
width: 10%;
display: inherit;
cursor: pointer;
margin-top: 0.8%;
}
#mob-home-btn{
display: inherit;
cursor: pointer;
margin-top: 0.8%;
width: 10%;
float: left;
}
#mob-logo{
display: inherit;
text-align: center;
margin: 0.2% auto;
width: 30%;
}
#mob-banner{
display: inherit;
}
.banner{
display: none;
}
.content{
width:100%;
background-color: white;
}
.logo{
padding-top: 1px;
}
#cat-header{
display: none;
}
.line{
display: none;
}
.table {
width: 100%;
}
#top-pages{
display: none;
}
.top-pages{
display: none;
}
.category-link{
float:left;
padding-top: 25px;
width: 510px;
padding: 15px 0;
}
.content h1 {
color:#031c3f;
font-size:24px;
text-align: left;
font-family: "UScoreRGK";
margin-left: 7px;
}
.content p {
margin-left: 10px;
margin-right: 10px;
}
#active_line{
margin-left: 10px;
margin-right: 10px;
}
#menu {
z-index: 0;
top: 0px;
position: absolute;
/*right: 0px!important;
left: auto!important;*/
}
#menu li {
list-style: none!important;
}
}
#media (min-width : 414px) and (max-width : 533px) {
.category-link{
width: 460px;
}
}
#media (min-width : 375px) and (max-width : 414px) {
.category-link {
width: 340px;
}
.wcmText ul, ol{
margin: 0 0 1em -2.5em;
}
.wcmText p{
margin-top: 0;
}
.wcmText h1, h2{
margin-top: 0;
margin-bottom: 0;
font-size: 110%;
}
}
#media (min-width : 360px) and (max-width : 375px) {
.category-link {
width: 282px;
}
.sidebar{
height: 38px;
}
}
#media (min-width : 320px) and (max-width : 360px) {
.wcmText ul, ol{
margin: 0 0 1em -2.5em;
}
.wcmText p{
margin-top: 0;
}
.wcmText h1, h2{
margin-top: 0;
margin-bottom: 0;
font-size: 110%;
}
}
#media (min-width : 240px) and (max-width : 320px) {
.sidebar{
background-image: url('top_background-320-2.png');
height: 52px;
}
#mob-menu-btn {
width: 7%;
margin-top: 4.8%;
margin-right: 4%;
}
#mob-home-btn {
width: 7%;
margin-top: 4.8%;
margin-left: 4%;
}
#mob-logo {
margin: 2% auto;
width: 45%;
}
.header_space {
height: 52px;
}
.list {
width: 99.5%;
overflow: hidden;
overflow-y: auto;
top: -9%;
overflow: hidden;
overflow-y: auto;
height: 803%;
}
.sports li {
width: 96%;
}
.content h1 {
color:#031c3f;
font-size:24px;
text-align: left;
font-family: "UScoreRGK";
margin-left: 7px;
}
.content p {
margin-left: 10px;
margin-right: 10px;
}
.category-link{
float:left;
padding-top: 25px;
width: 230px;
padding: 15px 0;
}
}
It looks like the only thing you are missing to make the ".header_space" work is to add
style="height: 100%;" to your HTML tag
<html style="height: 100%;">
or in your CSS
html { height:100% }
all your height properties, for example "height:100%" on the BODY tag, are not working.
although, i don't think your solution is an elegant one.
I would prefer to add
#media (max-width: 604px) {
/* lets say 50px is the height of your mobile menu */
#mob-banner { margin-top: 50px; }
}
to the the media query that handles your mobile views, instead of
<div class="header_space"></div>