Solved

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

Posted on 2013-05-28
4
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

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 10

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
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…

710 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