CSS3 Media query-responsive layout

Source: Internet
Author: User

In this era of mobile phone, tablet and computer-centric Internet. In order to improve the user experience, making the page adapt to different screen resolution is the most important issue when we write the page. The media query function in CSS3 is a good help to solve this problem, it can be based on the size of the screen up and down to show the user a usable interface.

Just started to contact the media query This function, I feel it's strong, one side anxious how should I use it? First of all we have to have a detailed understanding and understanding of it.

A media query is a rule that defines a style sheet through different media types and conditions. Allows CSS to work more precisely on different media types and different conditions for the same media. Most media features of media queries accept Min and Max to express "greater than or equal to" and "small and or equal". Such as: Width will have min-width and max-width. Media queries can be used on @media and @import rules in CSS, and can also be used in HTML and XML. Media queries are currently supported by Google Chrome, Safari 3, Firefox 3.5, Opera 7, and Internet Explorer 9. At the same time we have to meet the needs of older browsers, as long as our main model table is provided without using media queries, then the page can be designed in all browsers.


  Media Query Sample code:
@media screen and (width:800px) {...}
@media screen (max-width:800px) and (min-width:800px) {...}
@import URL (example.css) screen and (width:800px);
<link media= "screen and (width:800px)" rel= "stylesheet" href= "Example.css"/>
<?xml-stylesheet media= "screen and (width:800px)" rel= "stylesheet" href= "Example.css"?>


In the process of use, we can define 3 style settings or changes according to the large and small resolution of mobile phone, tablet and computer screen to achieve a higher user experience. The above is my opinion on media inquiries, welcome to the big God error correction points.

CSS3 Media query-responsive layout

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.