How is the responsive layout designed?

Source: Internet
Author: User

1. How to solve the compatibility problem between different devices?

Media query in CSS3 can solve this problem.

2. What values can media query get?

Device width and Height device-width,device-heigth display screen/tactile device.

The width and height of the render window width,heigth display screen/haptic device.

The handheld direction of the device, transverse or vertical orientation (portrait|lanscape) and printer.

Screen ratio aspect-ratio dot matrix printer.

Device ratio device-aspect-ratio-dot matrix printer.

The object color or color list color,color-index the display screen.

Resolution of the device resolution

3. Grammatical structure and usage

Syntax: @media device name only (select condition) not (pick condition) and (device selection condition), device two {srules}

Usage:

A, example one: Use @media in Link:

<link rel= "stylesheet" type= "Text/css" media= "only screens and (max-width:480px), only screens and (max-device-width:48 0px) "href=" Link.css "rel=" external nofollow "/>

The above use only can be omitted, limited to the computer monitor, the first condition max-width refers to the maximum width of the rendering interface, the second condition max-device-width refers to the maximum width of the device.

b, inline @media in the style sheet:

Copy CodeThe code is as follows:
@media (min-device-width:1024px) and (max-width:989px), screen and (max-device-width:480px), (max-device-width:480px)
and (Orientation:landscape), (min-device-width:480px) and (max-device-width:1024px) and (orientation:portrait) { Srules}


Set the computer monitor resolution (width) greater than or equal to 1024px (and the maximum visible width of 989px), the screen width in 480px and the following handheld devices, screen width in 480px and horizontal (that is, 480 dimensions parallel to the ground) placed handheld devices;

The screen is large or equal to 480px less than 1024px and vertically placed on the device's CSS style.

How is the responsive layout designed?

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.