media query responding in browser but not mobile - css

I have this media query with some CSS inside, the query works fine on other sites I have used with similar CSS, and when I resize the browser I get the desired effects. But when I look on iPad or android I see no effect, it is if the media query does not exist
#media only screen and (max-width: 767px) {
.menu-button{
display: block;
height: 42px;
background-image: url(/sites/all/themes/dream/images/menu-icon.png);
background-repeat: no-repeat,repeat-x;
background-position: 98% 50%,0 0;
text-align: right;
font-weight: 700;
font-family: 'SweetSans';
text-transform: uppercase;
color: #333333;
line-height: 42px;
cursor: pointer;
padding-right: 36px;
font-size: 13px;
margin-right: 106px;
}
.menu-button {
display: block;
height: 34px;
background-image: url(/sites/all/themes/dream/images/menu-icon.png);
background-repeat: no-repeat, repeat-x;
background-position: 98% 50%, 0 0;
text-align: right;
font-weight: 700;
font-family: 'SweetSans';
text-transform: uppercase;
color: #333333;
line-height: 42px;
cursor: pointer;
padding-right: 36px;
font-size: 13px;
}
#main {
width: 100%;
}
#block-menu-primary-links ul.menu li {
float: none;
padding: 0px 0px;
width: 100%;
display: none;
float: left;
background-color: rgb(172, 173, 184);
}
#main li {
float: none;
list-style-type: none;
font-weight: 400;
}
#main li.first a {
border-left: 0px;
}
#main li a {
width: 100%;
}
#main li ul, #main li ul li, #main li ul li a {
position: relative;
float: none;
width: 100%;
}
}

You have to add the veiwport tag to your HTML (in the head):
<meta name="viewport" content="width=device-width, initial-scale=1.0">

I think that the problem is that you're placing this piece at the top:
#media only screen and (max-width: 767px) {
.menu-button{
display: block;
height: 42px;
background-image: url(/sites/all/themes/dream/images/menu-icon.png);
background-repeat: no-repeat,repeat-x;
background-position: 98% 50%,0 0;
text-align: right;
font-weight: 700;
font-family: 'SweetSans';
text-transform: uppercase;
color: #333333;
line-height: 42px;
cursor: pointer;
padding-right: 36px;
font-size: 13px;
margin-right: 106px;
}
And it's being overridden by
.menu-button {
display: block;
height: 34px;
background-image: url(/sites/all/themes/dream/images/menu-icon.png);
background-repeat: no-repeat, repeat-x;
background-position: 98% 50%, 0 0;
text-align: right;
font-weight: 700;
font-family: 'SweetSans';
text-transform: uppercase;
color: #333333;
line-height: 42px;
cursor: pointer;
padding-right: 36px;
font-size: 13px;
}
Try placing the media query and its content at the bottom.
Let me know if that worked.
Regards

Related

How do I fix a Parse error [:] in my css?

This is the code associated with the assignment I am working on in my web development class. The W3C CSS Validator keeps giving me the following message: "64 Parse Error [:]". What is this and how do I fix it? Please help!
Here is my css:
* {
box-sizing: border-box;
}
body {
background-color: #ffffff;
color: #666666;
background-image: url(../images/background.jpg);
font-family: Verdana, Arial, sans-serif;
}
#wrapper {
background-color: #90c7e3;
width: 80%;
min-width: 700px;
max-width: 1024px;
box-shadow: 10px 10px 5px #888888;
margin-right: auto;
margin-left: auto;
}
header {
background-color: #000033;
color: #ffffff;
font-family: Georgia, "Times New Roman", serif;
}
h1 {
background-image: url(../images/sunset.jpg);
background-repeat: no-repeat;
background-position: right;
padding-left: 20px;
height: 72px;
line-height: 200%;
margin-bottom: 0;
}
nav {
float: left;
width: 160px;
padding-top: 20px;
padding-right: 5px;
padding-left: 20px;
padding-bottom: 0;
padding: 5px;
font-weight: bold;
}
nav a {
text-decoration: none;
}
nav a:hover {
color: #ffffff;
}
nav a:link: {
color: #000033;
}
nav a:visited {
color: #344873;
}
nav ul {
list-style-type: none;
margin: 0;
padding-left: 0;
}
main {
background-color: #ffffff;
margin-left: 170px;
padding-top: 1px;
padding-bottom: 1px;
padding-left: 20px;
padding-right: 20px;
display: block;
}
h2 {
color: #3399cc;
font-family: Georgia, "Times New Roman", serif;
}
h3 {
color: #000033;
}
dt {
color: #000033;
font-weight: bold;
}
.resort {
color: #000033;
font-size: 1.2em;
}
#homehero {
background-image: url(../images/coast.jpg);
height: 300px;
background-size: 100% 100%;
margin-right: 0;
margin-left: 170px;
background-repeat: no-repeat;
}
#yurthero {
background-image: url(../images/yurt.jpg);
background-size: 100% 100%;
background-repeat: no-repeat;
height: 300px;
margin-left: 170px;
}
#trailhero {
background-image: url(../images/trail.jpg);
height: 300px;
background-size: 100% 100%;
background-repeat: no-repeat;
margin-left: 170px;
}
footer {
background-color: #ffffff;
margin-left: 170px;
font-size: .70em;
font-style: italic;
text-align: center;
padding: 10px;
}
header, nav, main, footer {
display: block;
}
It's because of nav a:link: {
Replace it with nav a:link {

background disapear on mobile devices

I have this form here that disappear when I am on a mobile device. I really do not understand why? Can anybody help me figure that out? I have gone through the code, but I cannot find any solution on this.
.customclass h3{
margin: 0 0 20px 0;
font-family: 'Open Sans';
font-weight: 300;
color: #444;
text-transform: none;
font-size: 24px;
line-height: 30px;
}
#form_over .formResponsive .formHorizontal .formControls {
margin-left: 0
}
#form_over .formResponsive .formHorizontal .formControlLabel {
float: none;
width: auto;
padding: 0px;
text-align: left;
margin-bottom: 5px
}
#form_over .formResponsive input[type="text"] {
height: 35px;
padding-left: 10px;
font-size: 15px
}
#form_over .formResponsive .formHorizontal .rsform-block {
margin-bottom: 0
}
#form_over .formResponsive .formBody #tilmeld {
font-weight: 900;
font-size: 18px;
border-radius: 4px;
background-color: #166687;
background-image: none;
line-height: 50px;
padding-left: 25px;
padding-right: 25px;
width: 98% !important;
max-width: 98% !important;
border: none;
text-shadow: none;
-webkit-appearance: none
}
#form_over .formResponsive .formBody #modtag {
font-weight: 900;
font-size: 18px;
border-radius: 4px;
background-color: #166687;
background-image: none;
line-height: 50px;
padding-left: 25px;
padding-right: 25px;
width: 98% !important;
max-width: 98% !important;
border: none;
text-shadow: none;
-webkit-appearance: none;
background-color: #F1A900;
}
#form_over .formResponsive input {
width: 92%
}
#form_over .formResponsive {
margin-bottom: 0
}
In your custom.css file you have following code:
#media only screen and (max-width: 767px) { /* mobile devices */
.customclass {
position: relative;
top: 0px;
right: 0%;
z-index: 100;
height: 74%;
background: white;
padding: 0 50px;
}
}
As you can see the styles for the form are overridden when the screen is 767px wide or less. Just remove background: white; and you'll be fine.

Overlay adjusting the height to content

i'm trying to have the height auto adjust based on the content that's in the div.. i realize to do this, I shouldn't have a height: xpx;.
my popover is:
.popover {
position: absolute;
top: 0;
left: 0;
height: 120px;
z-index: 1010;
display: none;
max-width: 276px;
text-align: left;
white-space: normal;
background: #fff;
padding: 10px;
font-size: 12px;
}
what's currently in the div of that popover is:
span.details{
display: block;
font-family: Georgia,serif;
margin: 0 0 15px 0;
color: #888;
}
span.status{
display: block;
margin-bottom: 10px;
margin-top: -7px;
}
span.status strong{
font-size:x-small;
vertical-align:top;
}
span.date{
display: inline-block;
float: right;
font-style: italic;
font-weight: bold;
font-size: 11px;
}
span.url{
display: inline-block;
font-style: italic;
font-size: 12px;
font-family: "Arial Black", Gadget, sans-serif;
margin-right: 5px;
}
what it looks like without the height: 120px;
http://sc-cdn.scaleengine.net/i/2952f44fb396097037f8f5eaeabc52cd.png
what it looks like with the height: 120px;
http://sc-cdn.scaleengine.net/i/614d383b7cba18a7f7a9bc017f53b9c4.png
any ideas here guys? i just want it to adjust to whatever is in the box!
.popover {
display:block;height:100%
}
try this

mobile browser not allowing scrolling

I just tested my new site with my android phone and I am not able to scroll anywhere on the page. On Firefox, opera, ie, and chrome desktop browsers I get vertical scroll when needed. In my html, body css rule I've got overflow-y to scroll; Width should not be scrolled. I'm probably missing something simple here but I've never come across this in any other sites I've done.
Here's my css for the site:
#charset "utf-8";
/* CSS Document */
#body{
min-width: 900px;
width: 75%;
background-size: cover;
background-image: url(../graphics/back2.jpg);
position: relative;
margin: 40px auto;
padding: 10px;
border-style: groove;
border-width: 5px;
border-color: #000;
background-repeat: repeat-y;
}
a:link, a:visited, a:active{
text-decoration: none;
color: inherit;
}
a:hover{
color: #FFF;
text-decoration: underline;
}
html, body{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow-y: scroll;
background-image: url(../graphics/craig-smith-background.jpg);
line-height: 25px;
}
h1{
font-size: 36px;
font-family: "Times New Roman", Times, serif;
color: #000;
margin: 10px;
}
h2{
font-size: 30px;
font-family:"Times New Roman", Times, serif;
margin-left: 30px;
color: #333;
font-weight: 700;
margin: 20px;
}
h3{
font-size: 24px;
margin: 10px;
}
p{
font-size: 20px;
font-family: "Times New Roman", Times, serif;
color: #FFF;
text-indent: 1.5em;
margin-left: 1.5em;
}
#quote{
margin-left: 30px;
font-style: italic;
font-family: lucida;
font-size: 18px;
border-style: inset;
border-color: #333;
border-width: 2px;
height: 80px;
}
#header{
width: auto;
margin: 0 auto;
position: relative;
text-align: center;
}
#nav{
position: absolute;
z-index: 1;
left: 25%;
top: 150px;
}
.picture{
display: inline-block;
position: relative;
margin: 0 auto;
border-style: groove;
border-width: 5px;
border-color: #999;
}
.clear-left{
clear: left;
position: relative;
}
.clear-right{
clear: right;
position: relative;
}
.clear-all{
clear: both;
position: relative;
}
#left-col{
width: 25%;
min-width: 300px;
position: relative;
float: left;
text-wrap: normal;
overflow: hidden;
margin-bottom: 10px;
margin-top: 10px;
text-align: right;
}
#right-col{
min-height: 500px;
min-width: 500px;
width: 65%;
text-align: left;
float: right;
border-style: groove;
border-width: 5px;
border-color: #CCC;
margin-bottom: 10px;
margin-top: 10px;
text-wrap: normal;
text-indent: 10px;
}
#footer{
width: 85%;
height: 40px;
background-color: #999;
text-align: center;
margin: 10px auto;
padding: 0px;
padding-bottom: 10px;
border-style: groove;
border-width: 2px;
border-color: #999;
}
#project-description h1{
text-align: center;
font-size: 36px;
}
.project-description h2{
color: #333;
font-weight: bold;
}
.project-description{
border-style: inset;
border-width: 3px;
border-color: #333;
margin: 10px;
padding: 5px;
}
.project-description p{
margin-left: 70px;
text-indent: 0;
}
table{
border-spacing: 0;
border-collapse: collapse;
}
td, th, tr{
padding: 0;
line-height: 20px;
}
And here's a link the live site.
You don't need to give the body and html tags the overflow-y: scroll; style. That is resulting in a double scrollbar which is failing in mobile browsers. You don't even need to specify that as it is default behavior. You may want to set overflow-y: scroll; and overflow-x: hidden; on the body tag only.

Background image css opera issue

Am having an issue in opera. I have a series on hyperlinnks in a ul li with backgorund images applied. The pointer cursor isnt displaying when I hover over the links.
Is this a know bug, code below
/cricket" title="Cricket" id="cricket-link" style="background-image:url(/wp-content/themes/blank2L/images/sidebar-cricket-bg.jpg);" onmouseover="$().hoverSidebarImage('/wp-content/themes/blank2L/images/sidebar-cricket-bghover.jpg', 'cricket'); return false;" onmouseout="$().originalSidebarImage('/wp-content/themes/blank2L/images/sidebar-cricket-bg.jpg', 'cricket'); return false;">Cricket
#sidebar ul {
margin: 0;
padding: 0 0 27px 16px;
display: block;
float: left;
width: 180px;
}
#sidebar ul li {
background-image: url(images/left-nav-bg.jpg);
background-repeat: no-repeat;
margin: 0;
margin-bottom: 10px;
padding: 0;
display: block;
float: left;
width: 180px;
height: 40px;
list-style-type: none;
cursor:pointer !important;
}
#sidebar ul li a {
background-repeat: no-repeat;
background-position: 2px 2px;
margin: 0;
padding: 8px 8px 0 4px;
display: block;
float: left;
width: 168px;
height: 32px;
color: #ffffff;
font-family: Helvetica, Arial, sans-serif;
font-size: 18px;
font-weight: bold;
text-align: right;
cursor:pointer !important;
}
you should use hover stage for this id
#sidebar ul li hover{
background-repeat: no-repeat;
background-position: 2px 2px;
margin: 0;
display: block;
float: left;
width: 168px;
height: 32px;
color: #ffffff;
font-family: Helvetica, Arial, sans-serif;
font-size: 18px;
font-weight: bold;
text-align: right;
cursor:pointer !important;
}
add this css in your style.
Issue solved, changed mouseover and mouseout events to be return true;

Resources