Review of the use of CSS3 responsive layout design

Source: Internet
Author: User
Responsive design is a different type of resolution displayed under different devices.
The media property is used to specify different styles for different media types. Re-render the page with the browser's width and height eradicated.
Syntax: @media mediatype and | Not | Only (Media feature) {}
Example:
<link rel= "stylesheet" media= "screen and (max-width:600px)" href= "Small.css"/>
Result: Display the style in this style sheet when the resolution is as large as 600.

Media Type:

All for all devices

Print for printers and printing devices

Screen for computer screens, tablets, smartphones.

Speech for audible devices such as readers

Key words:

The AND operator is used to match both rules on both sides of the symbol.

@media screen and (max-width:600px) {
/* Match a computer screen with a width of less than 600px */
}

The NOT keyword is the type of media used to exclude a system.
@media not print {
/* Match all devices except the printer */
}
Only used to set a specific type of media.
@media only screen and (min-width:300) and (max-width:500) {
/* This paragraph is only for color screen devices */
}

Media features: (common)

Max-width (max-height): Maximum width and maximum height

@media (max-width:600px) {
Matches devices with an interface width less than 600px
}
Min-width (min-height): Minimum width and height
@media (min-width:400px) {
The maximum width of a device that matches an interface width greater than 400px
}
Max-device-width (max-device-height) device and height
@media (max-device-width:800px) {
Match device (not interface) width less than 800px device
}
Min-device-width (min-    Device-height): Maximum width and height of the device
@media (min-device-width:600px) {
Match device (not interface) device with width greater than 600px
}
      orientation:portrait vertical screen
<link rel= "stylesheet" media= "All and
(orientation:portrait)"
href= "Indexa.css"/>
Result: This type is displayed in the vertical screen
Orientation:landscape horizontal
<link rel= "stylesheet" media= "all and
(orientation:landscape) "
href=" Indexa.css "/>
Result: This type is displayed on a horizontal screen

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.