Media Query Code

Source: Internet
Author: User

Tags: dia big screen width media type IDT style code Sky

First, write directly in the media query

@media Media type and (media attribute) {your style}

.d1{    width:200px;    height:600px;    background:#000;  }  /*  超小屏幕 手机> */  @media screen and (max-width:768px){    .d1{      background:skyblue;    }  }  /*  小屏幕 平板 */  @media screen and (min-width:768px) and (max-width:992px){    .d1{      background:#999;    }  }  /*  中等屏幕 桌面显示器 */  @media screen and (min-width:992px) and (max-width:1200px){    .d1{      background:blue;    }  }  /*  大屏幕 大桌面显示器> */  @media screen and (min-width:1200px){    .d1{      background:pink;    }}
Second, link CSS
<link rel="stylesheet" type="text/css"  href="styleA.css" media="screen(max-width:768px)"><link rel="stylesheet" type="text/css"  href="styleB.css" media="screen(min-width:768px) and (max-width:992px)"><link rel="stylesheet" type="text/css"  href="styleC.css" media="screen(max-width:992px) and (max-width:1200x)"><link rel="stylesheet" type="text/css"  href="styleD.css" media="screen(min-width:1200)">

Media Query Code

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: and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: