Media query in CSS3_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:47:41
Original
1092 people have browsed it

In the past few days, I have been reading CSS3 on MOOC.com, which is very detailed.
The address is here: http://www.imooc.com/code/1405


Take notes:


1. Media query in css3

1. In CSS3 10 media query types

value Device type
all All devices (requires familiarity)
screen Screen display (needs familiarity)
print Print paper or print preview view (requires Familiar)
braille Braille tactile feedback device for the blind
embossed Braille printer
handheld Portable device
projection Various projection devices
speech Speech or audio synthesizer
tv TV type Device
tty  Media that uses a fixed density letter grid, such as teletypewriters and terminals


2. Reference methods for common 3-fold media types

① link method

<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
Copy after login


② @import method
@importurl(reset.css) screen;   
Copy after login

③ @media method

<style type="text/css">    @media screen{    选择器{/*你的样式代码写在这里…*/}}</style>
Copy after login

3 . How to use media queries

@media media type and (media properties) {your style}


Media type: the 10 mentioned above
Media properties: max-width:400px Maximum width
                                                                                                                                                                                                                                                                                   🎜>

②Exclude a certain device


③Only use a certain device

/*用and连接*/@media screen and (min-width:600px) and (max-width:900px){  body {background-color:#f5f5f5;}}
Copy after login

2. Response Layout skills in style design

/*用not*/@media not print and (max-width: 1200px){    样式代码}/*上面代码表示的是:样式代码将被使用在除打印设备和设备宽度小于1200px下所有设备中。*/
Copy after login

First, try to use as few irrelevant divs as possible;

Second, don’t use inline elements (inline);

/*用only*/<linkrel="stylesheet" media="only screen and (max-device-width:240px)" href="android240.css" />
Copy after login
Third, try to use as few divs as possible JS or flash;
Fourth, discard useless absolute positioning and floating styles;

Fifth, abandon any redundant structures and do not use 100% settings.

Sixth, try to use H5 meaningful tags


What kind of layout or HTML structure is simple and clean
? Here I will teach you a quick test method.
You first disable all styles in your page (and information related to styles
) and open it in the browser. If your content
is arranged in an orderly manner and is easy to read, then your The structure
won’t be any worse.























Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template