Media queries common introduction and compatibility problem solving

Source: Internet
Author: User

Media query medium queries, responsive layout of the sharp edge.
This article contains two pieces of content:
One, Common introduction
Second, how to solve the problem that IE does not support

First, commonly used introduction
If you have the ability to crossing (strongly recommended), the following introduction (the common part) can not be looked at, address: https://www.w3.org/TR/css3-mediaqueries
1, two common types of introduction
A, via link media = "type and (attribute)"
B, @media type and (attribute) in CSS
Note: Type:screen print all ... attribute:max-width, min-width,... Multiple attribute can be again and (attribute)

2, commonly used type and attribute
Media queries are commonly used in multi-screen adaptive, so the type on the use of many screens, if there is no special qualification can be used all meaning all types under the effective
Attribute commonly used: Max-width: Values + units for maximum length within the effective, as well as the min-width meaning minimum length range within the effective
Both can be used at the same time to implement code under the screen width within two boundaries.

Second, IE compatibility issues

IE low version, not supported.
Project needs to be compatible ie7+ GitHub found a plug-in Https://github.com/scottjehl/Respond can be implemented compatible ie6+
Talk about the problems encountered: internal style, according to the use of the introduction, the corresponding JS file in the style behind, how also out of effect, after the introduction of external styles to solve the problem.

Attached: Common Introduction Demo

<! DOCTYPE html>  

1.css

P:nth-child (1) {
    color: #f00;
    font-weight:600;
}

2.css

P:nth-child (2) {
    color: #f0f;
}

3.css

@media screen{
    P:nth-child (3) {
        color: #727486;
    }
}

4.css

@import "3.css";
P:nth-child (4) {
    color: #0f0;
}

5.css

@media all and (min-width:500px) {
    P:nth-child (5) {
        color: #7093ff;
    }
}
@media all and (max-width:1000px) and (min-width:500px) {
    P:nth-child (5) {
        color: #ff8696;
    }
}

6.css

@media not print{
    P:nth-child (6) {
        color: #ffb778;
    }
}

7.css

 @media all and (orientation:portrait) {p{font-family: "Blackbody";
    font-size:32px;
        }} @media all and (Orientation:landscape) {p{font-family: "Arial";
    font-size:16px; }
}
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.