Detailed explanation of adaptive web page layout @media screen

PHPz
Release: 2017-04-02 10:16:12
Original
1864 people have browsed it

Use @media screen to realize adaptive web page layout

Advantages: No need for plug-ins and mobile themes, friendly to mobile devices, and able to adapt to various window sizes. Just add the @media screen attribute in CSS to determine and output different length and width values ​​based on the browser width

1280 resolution or above (greater than 1200px)

@media screen and (min-width:1200px){
    #page{ width: 1100px; }#content,.div1{width: 730px;}#secondary{width:310px}
}
Copy after login

1100 resolution (greater than 960px, less than 1199px)

@media screen and (min-width: 960px) and (max-width: 1199px) {
    #page{ width: 960px; }#content,.div1{width: 650px;}#secondary{width:250px}select{max-width:200px}
}
Copy after login

880 resolution (greater than 768px, less than 959px)

@media screen and (min-width: 768px) and (max-width: 959px) {
    #page{ width: 900px; }#content,.div1{width: 620px;}#secondary{width:220px}select{max-width:180px}
}
Copy after login

720 resolution (greater than 480px, less than 767px)

@media only screen and (min-width: 480px) and (max-width: 767px){
    #page{ width: 450px; }#content,.div1{width: 420px;position: relative; }#secondary{display:none}#access{width: 450px; }#access a {padding-right:5px}#access a img{display:none}#rss{display:none}#branding #s{display:none}
}
Copy after login

440 resolution or less (less than 479px)

@media only screen and (max-width: 479px) {
    #page{ width: 300px; }#content,.div1{width: 300px;}#secondary{display:none}#access{width: 330px;} #access a {padding-right:10px;padding-left:10px}#access a img{display:none}#rss{display:none}#branding #s{display:none}#access ul ul a{width:100px}
}
Copy after login

The above is the detailed content of Detailed explanation of adaptive web page layout @media screen. For more information, please follow other related articles on the PHP Chinese website!

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