Free HTML5 serial came the "HTML5 Web development Case Specific explanation" serial (vi) Media inquiries

Source: Internet
Author: User

There is also an important technical means for responsive design is media query. Assuming that the simple design of a streaming layout system ensures that each grid is scaled up and down proportionally, it is possible that a small screen (such as a mobile device) grid is too small to affect reading, which is not designed to be responsive. Media queries are able to solve this problem. Media queries can provide specific styles for specific browsers and devices. Media queries are a new feature of CSS 3 and an extension of the media type.

Hint: The list of 10 media types, please refer to http://www.w3.org/TR/CSS2/media.html#media-types.

In a responsive design, media queries are typically defined in CSS, such as the most common way to set a style with a screen width of less than 1024px, such as the following code:

@media screen and (max-width:1024px) {

At this point the style is set at less than 1024px

}

Set the style when the screen width is less than 600px, such as the following code:

@media screen and (max-width:600px) {

At this point the style is set at less than 600px

}

To set the style of the screen width between 600px~900px, the code is as follows:

@media screen and (max-width:600px) and (min-width:900px) {

Set style

}

Set the device's actual resolution to less than 480px when the style (such as the iphone), code such as the following:

@media screen and (max-device-width:480px) {

iphone phone style is set here

}

Set the style for ipad or iphone in landscape, code such as the following:

@media screen and (Orientation:landscape) {

At this point, set the style

}

Tip: A lot of other media inquiries please refer to http://www.w3.org/TR/css3-mediaqueries/.

Learning HTML5 The best book is "HTML5 Web page Development Example specific explanation", using code learning case study, can be more interesting than reading text!!! A book to fix the HTML5, from now on start.


Free HTML5 serial came the "HTML5 Web development Case Specific explanation" serial (vi) Media inquiries

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.