Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-05-28
4
Medium Priority
?
250 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Suggested Courses

722 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