Responsive web design @ media, responsive web @ media

Source: Internet
Author: User

Responsive web design @ media, responsive web @ media

Either way, you can determine the device size directly in the link and then reference different css files:

1 <link rel="stylesheet" type="text/css" href="styleA.css" media="screen and (min-width: 400px)">

When the screen width is greater than or equal to px, stylea.css is used.

In media attributes:

1 <link rel="stylesheet" type="text/css" href="styleB.css"media="screen and (min-width: 600px) and (max-width: 800px)">

When the screen width is greater than or less, styleb.css is applied.

Another method is to directly write it in the <style> label:

12345 @ Media screen and (max-width: 600px) {/* apply the following CSS style when the screen size is smaller than 600px */  .class {    background: #ccc;  }}

The method is to add @ media, and the other attributes are the same as those in the link.
Max Width
The following style will be applied when the width of the visible area is smaller than PX.

123456 @media screen and (max-width: 600px) {  .class {    background: #fff;   Your style  }}

Min Width
The following style will be applied when the width of the visible area is greater than 900px.

12345 @media screen and (min-width: 900px) {  .class {    background: #fff;  }}

Multiple Media Queries
You can also use a matching condition. The following style will be applied when the width of the visible area is between 600px and 900px.

 

12345 @media screen and (min-width: 600px) and (max-width: 900px) {  .class {    background: #fff;  }}

 

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.