CSS3--Media enquiry

Source: Internet
Author: User

Media Enquiry:

1, media query advantages: Based on the device's property detection device, so that you do not need to use browser detection script, and then allow the ability to directly install the device to set the target style sheet, that is, to detect the user to use a small screen device, CSS rules will be adjusted to fit the screen size, from the screen to remove extraneous elements, Provide a smaller picture to make the text clearer

2. Grammar

@link element Invocation, separated by commas in the middle of multiple media selections

1 <  href= ""  rel= "stylesheet"  media= "Logic Media and ( Expression) ">
1 <  href= ""  rel= "stylesheet"  media= "Srceen,projection"  >

@import Directive invocation

1 @import url ("file") logic media and (expression)

@ Add in style sheet or STYLE element

1 @media Logic Media and (expression) {2      rules  3 }

3. Media Features

@ Style

1 @media screen (min-width:400px) {2      h1{3           background:4        }5 }

@ Device Width and height

1 @media Media and (device-width:1024px) {rules} 2 @media Media and (max-device-width:1024px) {rules} 3 @media Media and (min-device-width:1024px) {rules}

@ Direction

1 @media Media and (orientation:landscape/portrait) {rules}

@ aspect ratio

1 @media Media and (aspect-ratio:horizontal/vertical) {rules} 2 @media Media and (device-aspect-ratio:horizontal/vertical) {rules}

@ pixel ratio

1 @media Media and (-webkit-device-pixel-ratio:number) {rules} 2 @media Media and (-moz-device-pixel-ratio:number) {rules} 3 @media Media and (Max--moz-device-pixel-ratio:number) {rules} 4 @media Media and (Min--moz-device-pixel-ratio:number) {rules}

CSS3--Media enquiry

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.