Usage of media queries

Source: Internet
Author: User

@media all and (min-width:840px)//  screen application Rule @media (min-width:800px)//shorthand for all minimum horizontal screen widths of 800 pixels              , ibid. @media ( min-width:800px) and (max-width:1200px)    //all screens between 800px and 1200px apply Rule @media (min-width:800px) or (orentation: Portrait)         //width is at least 800px or the direction is longitudinal, the rule will be applied @media (not min-width:800px)        ///When the minimum width is not 800px, this rule @media (width : 800px) and (height:400px)         //When the screen is exactly 800px wide, 400px High applies rule @media (min-width:700px), handheld and (orentation: Landscape)    //minimum width of 700px or horizontal screen handheld device, while applying the style

There are two ways to apply media queries:

1. CSS Media query in LINK element

<rel= "stylesheet"  media= "(max-width:800px)"  href = "Eg.css" />

2. CSS media query in style sheet

@media (max-width:600px) {  . div1{         display:none;    }   }

Best Practices for media queries:

Small screen (flat, greater than or equal to 768px)

@media (min-width:768px) {......}

Medium screen (desktop monitor, greater than or equal to 992px)

@media (min-width:992px) {......}

Large screen (large desktop display, greater than or equal to 1200px)

@media (min-width:1200px) {......}

Usage of media queries

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.