Home > Web Front-end > HTML Tutorial > [Transfer] Responsive web design CSS3 Media Queries_html/css_WEB-ITnose

[Transfer] Responsive web design CSS3 Media Queries_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:43:48
Original
919 people have browsed it

Start studying responsive web design, CSS3 Media Queries is an introduction.

Media Queries, their function is to allow adding expressions to determine the media environment, so as to apply different style sheets. In other words, it allows us to change the layout of the page to precisely fit different devices without changing the content.

So, how do Media Queries work?

Two ways, one is to directly determine the size of the device in the link, and then quote different css files:

<link rel="stylesheet" type="text/css" href="styleA.css" media="screen and (min-width: 400px)">
Copy after login

means when the width of the screen When it is greater than or equal to 400px, apply styleA.css

in the media attribute:

  • screen is one of the media types. CSS2.1 defines 10 media Types
  • and are called keywords. Other keywords include not (exclude a certain device), only (limit a certain device) Device)
  • (min-width: 400px) is the media attribute, which is placed in a pair of parentheses. For complete features, please refer to the related Media features section
  • <link rel="stylesheet" type="text/css" href="styleB.css"  media="screen and (min-width: 600px) and (max-width: 800px)">
    Copy after login

    means that when the width of the screen is greater than 600 and less than 800, other attributes can be seen using styleB.css

    Here: http://www.swordair.com/blog/2010/08/431/

    Another way is to write it directly in the