Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Suggested Courses

627 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