Created by
Progressive enhancement is a design philosophy that centers around providing a baseline of essential content and functionality to as many users as possible, while at the same time going further and delivering the best possible experience only to users of the most modern browsers that can run all the required code.Progressive_Enhancement @MDN
Graceful degradation is a design philosophy that centers around trying to build a modern web site/application that will work in the newest browsers, but fall back to an experience that while not as good still delivers essential content and functionality in older browsers.Graceful_degradation @MDN
RWDResponsiveWebDesign
@media [media_type and] [(media_feature_expr)*]{CSS Rules}
@media (min-width: 600px){}
@media (min-width: 600px) and (max-width: 1000px ){}
@media print and (min-width: 600px){}
@media print and (orientation: landscape){}
@media print and (min-width:800px),
print and (orientation: landscape){}
@media [media_type and] [(media_feature_expr)*]{CSS Rules}
not
or only
logical operators, the media type is optional and defaults to all
.
@media screen and (max-width: 600px){}
@media (max-width: 600px){}
@media (hover: none){}
@media (orientation: portrait){}
@media (display-mode: fullscreen){}
box 1
box 2
box 3
.box{
border: 1px solid red;
box-sizing: border-box;
}
@media screen and (max-width:375px){
.box {
width: 370px;
float: none;
}
}
@media (min-width: 375px) and (max-width: 812px) {
.box {
width: 50%;
float: left;
background: blue;
}
}
@media (min-width: 812px) {
.box {
width: 30%;
float: left;
}
}
not
, and
, and only
can be used to compose a complex media query.,
(comma) we can combine multiple media queries into one. If any of them is true
then the entire media rule is considered as True.
@media (min-width: 375px) and (max-width: 812px){}
@media only screen and (min-width: 375px){}
$iPhoneX: "(min-width: 375px) and (max-width: 812px)";
$desktop: "(min-width: 812px)";
.box{
width: 370px;
float: none;
border: 1px solid red;
box-sizing: border-box;
}
@media #{$iPhoneX}{
.box{
width: 33%;
float: left;
background: blue;
}
};
@media #{$desktop}{
.box{
width: 30%;
float: left;
}
}
$iPhoneX: "(min-width: 375px) and (max-width: 812px)";
$desktop: "(min-width: 812px)";
.box{
width: 370px;
float: none;
border: 1px solid red;
box-sizing: border-box;
@media #{$iPhoneX}{
width: 33%;
float: left;
background: blue;
};
@media #{$desktop}{
width: 30%;
float: left;
}
}
.box {
width: 370px;
float: none;
border: 1px solid red;
box-sizing: border-box;
}
@media (min-width: 375px) and (max-width: 812px) {
.box {
width: 33%;
float: left;
background: blue;
}
}
@media (min-width: 812px) {
.box {
width: 30%;
float: left;
}
}
Or "Hardware pixels" and "Software pixels"
These slides are based on
customised version of
framework