A Web Design Community curated by Chris Coyier

A little dab'll do ya

Code Snippets

Code Snippets > CSS > iPad Orientation CSS Submit one!

iPad Orientation CSS

<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css">
<link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css"> 

Reference URL

Subscribe to The Thread

  1. This is pretty sweet wish i had an ipad to try it out on..

  2. Cody Robertson says:

    I would add a bit more queries to it. This would have the same effect on the iPhone.

  3. That’s what I’ve been looking for – I’ve thought it ridiculous that you need javascript to apply some styling based on orientation.

  4. Pete Robie says:

    Something to keep in mind is adding a check for the platform like below


    if(navigator.platform == 'iPad' || navigator.platform == 'iPhone') {
    document.write("");
    document.write("");
    }

    This way it doesn’t get loaded unless the platform matches.

    • Pete Robie says:

      in the “‘s place the LINKs as listed above. Not sure why they didn’t show. :-/

It's Your Turn

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
--- The Management ---