ipad to create a simple demo target CSS page

Source: Internet
Author: User
Tags query version

Translated from: IPad Orientation CSS

When the ipad is finally released, Jason Grigsby has done a useful experiment in distinguishing between the ipad and the Safari browser in the iphone.

For the most part, the mobile version of Safari on the ipad is the same thing as on the iphone. One difference I've found is that the WebKit on the ipad supports orientation (orientation) based CSS Media query statements.

I created a simple page to demonstrate the target CSS for the ipad.

Using orientation in CSS is very simple, and the code does this:

<link rel= "stylesheet" media= "All and (orientation:portrait)" href= "Portrait.css" >
<link rel= " Stylesheet "Media=" All and (Orientation:landscape) "href=" Landscape.css ">

In this example, the only difference in the two CSS files is to hide one of the headings. The HTML portion of the demo page is as follows:

<H1 id= "Portrait" >you ' re viewing in Portrait mode

portrait.css in the CSS is simply hiding the landscape part of the <H1>:

#landscape {Display:none}

Of course, the role ofLandscape.css is the opposite.

You can see this CSS query in the latest version of Safari/chrome and Firefox. Simply change the window size of your browser so that its height is greater than the width, and you can see the effect.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.