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)">
means when the width of the screen When it is greater than or equal to 400px, apply styleA.css
in the media attribute:
<link rel="stylesheet" type="text/css" href="styleB.css" media="screen and (min-width: 600px) and (max-width: 800px)">
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