Media queries syntax Summary

Source: Internet
Author: User
Media queries syntax Summary

The media queries syntax is as follows:

@ Media [media_query] media_type and media_feature

When using the media queries style module, it must start with "@ media.

Media_query indicates the query keyword. The not keyword and only keyword can be used here. The not keyword indicates that a reverse operation is performed on the subsequent style expressions. For example, the following code:

@ Media not screen and (max-device-width: 480px)

The only keyword allows devices that do not support mediaqueries but can read mediatype to ignore this style. For example, the following code:

@ Media only screen and (max-device-width: 480px)

For mobile devices that support media queries, if the only keyword exists, the Web browser of the mobile device ignores the only keyword and applies the style file directly according to the following expression. For devices that do not support mediaqueries but can read the mediatype type, this style file is ignored when the only keyword is encountered.

Although the media_query type is not a required type in the entire media queries syntax, it is sometimes a very important query parameter type in the actual development process.

The media_type parameter specifies the device type, which is usually called the media type. In fact, this media type has been defined in css2.1. Table 6-1 lists the 10 device types that can be defined by media_type.

 

 

Media_feature is mainly used to define the device features in CSS. Most mobile device features allow the prefix of min/max. For example, Min-width indicates that the value is greater than or equal to this value; max-width indicates that the value is less than or equal to this value.

Table 6-2 lists the features of media_feature devices.

 

 

So far, the media queries style module has been supported by most modern browsers on the desktop. For example, ie 9, Firefox, Safari, chrome, and operabrowser. However, only the latest version of the IE series browser supports this feature. Versions earlier than IE8 do not support media.
Queries.

For mobile platforms, Web browsers Based on Android and IOS have also been well supported. Blackberry mobile phones also support media.
Queries features.

 

This article is excerpted by Tang Jun from HTML5 mobile Web Development Guide

Book details: http://blog.csdn.net/broadview2006/article/details/7609750

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.