Once, those who visited websites from smartphones and similar mobile devices only aroused laughter from those around them. Many simply could not understand why this is necessary, because there are such convenient stationary computers! Or, at worst, laptops. In addition, mobile Internet was then expensive.
As time went. Internet is cheaper. More phones and tablets went on sale. Some time later, the owners of popular sites puzzled their heads. According to statistics, it turned out that their resources are more often visited from smartphones than from stationary PCs!
In those days, sites were not optimized for viewing from mobile devices. Having come to the old resource from the phone, you would have to be content with small letters, small menu items and uncomfortable buttons.
The advent of CSS Media Queries
, . . , , , , , «» – . , .
CSS3 Media Queries. .
?
, , . ? .
, . . . . . , . – , . , , .
«» . , . . . , .
, CSS3 Media Queries. … :
, Responsive Web Design Media Queries. .
?
CSS Media Queries CSS3, . , , (/).
, ? . . , , , . CSS, .
CSS Media Queries
, Safari Chrome. , Internet Explorer … – , IE, .
Media Queries
, , html. ? <link rel=’stylesheet’ type=’text/css’ href=’style.css’> , : media=’screen’.
! , . screen print – , .
:
- all – , , ;
- scrteen – (, , , , );
- print – ;
- projection – ;
- speech – ;
- braille – ;
- tv – .
. CSS Media Queries, . , – all.
css. :
@media screen and (max-width: 1024px) {( }
@media, , , (screen – ) . CSS Media Queries Max Width. , , 1024px. Screen and . :
@media (max-width: 1024px) {}
, , .
, , . , , , 320px, 500px. :
@media (min-width: 320px) and (max-width: 500px) {}
, nj , and. , : , . . . 320 500 .
and . , . , – .
– . - , - – . orientation:portrait, , , orientation:landscape. @media. and.
. and or. , ! :
@media (max-width: 500px) or (orientation:portrait) {}
500px , .
not
not. :
@media (not max-width:700px) {}
, 700 .
. W3C. :
- orientation ( );
- width (, );
- height ().
, , .
?
- . , , , , .
. . , div, :
div {
color: red;
}
:
@media (min-width: 320px) {}
.
, «» css. . .
– . , import . , .
? . , .
Also do not forget that you can simplify your life with the latest software tools. It's not just about preprocessors. Using Gulp Group CSS Media Queries can make the process much more convenient. We recommend that you master this tool or some of its analogues.