Solved

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

Posted on 2013-05-28
4
234 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
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…

930 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

12 Experts available now in Live!

Get 1:1 Help Now