Solved

Why does my stylesheet not change when my user goes from landscape to portrait?

Posted on 2013-05-28
4
233 Views
Last Modified: 2013-05-28
Head out to http://www.hihatwebdesign.com/mobile/about.php

I've got the following in my header:

<!DOCTYPE html>
<html lang="en">
<head>
<title>Laverge Smiles Family Dentistry</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<link media="screen and (max-device-width: 320px)" href="landscape.css" type="text/css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<map name="contact_images">
<area shape="rect" coords="89,11,127,47" href="https://www.facebook.com/pages/LaVergne-Smiles-Family-Dentistry/194700547255806?fref=ts">
<area shape="rect" coords="142,10,180,49" href="">
<area shape="rect" coords="195,10,233,47" href="mailto:info@lavergnesmiles.com">
</map>
<map name="menu">
<area shape="rect" coords="10,16,304,54" href="about.php">
<area shape="rect" coords="12,79,301,107" href="services.php">
<area shape="rect" coords="12,140,302,166" href="patel.php">
<area shape="rect" coords="11,200,299,225" href="testimonials.php">
<area shape="rect" coords="10,260,302,286" href="patients.php">
<area shape="rect" coords="10,317,299,344" href="contact.php">
<link rel="Stylesheet" type="text/css" href="css/smoothDivScroll.css" />
</head>

Open in new window


I'm thinking that the "<link media="screen and (max-device-width: 320px)" href="landscape.css" type="text/css" rel="stylesheet" />" line gives provides a different stylesheet when my user rotates their mobile device from landscape to portrait.

I'm doing something wrong because it doesn't seem to work and I'm hoping someone can show me where I'm blowing it.

Thanks!
0
Comment
Question by:brucegust
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Ishaan Rawat
ID: 39202104
What you do is copy all the styles of landscape.css and put then in your normal CSS under the header.. media screen and (max-device-width: 320px) like the following..
@media screen and (max-width: 320px){

// Copy all the landscape code here...

}

Open in new window

0
 

Author Comment

by:brucegust
ID: 39202134
Do I need to do anything with this line of code in my header:

<link media="screen and (max-device-width: 320px)" href="landscape.css" type="text/css" rel="stylesheet" />

This isn't in my stylesheet, this is in the header portion of my page. Bottom line: is the "href="landscape.css" need to be changed to "stylesheet.css" which is where I just put all my css dynamics that apply to the landscape view.
0
 
LVL 9

Accepted Solution

by:
Ishaan Rawat earned 500 total points
ID: 39202157
Do the following...

Remove the line of linking of the landscape.css....

Copy all the code of landscape.css where it is written //Code of landscape.css...

@media screen and (max-width: 320px){

// Copy of landscape.css

}

Open in new window


and then paste the above whole code in your normal css stylesheet like this...

example..

*{ ...}
body { ....}
...
.
.
..
.

@media screen and (max-width: 320px){

// your landcape.css code...

}

Open in new window

0
 

Author Closing Comment

by:brucegust
ID: 39202418
Awesome!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now