img {
width: 100%;
}
.pic {
background-size: cover;
background-image:
image-set(url(...) 1x,
url(...) 2x;}
About 80% of sites demonstrate the same weight
and load time at different resolutions.
(mediaqueri.es)
by @scottjehl
https://speakerdeck.com/scottjehl/responsive-responsible...is a good idea, I'm telling you.
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}
/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}
/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}
/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
@media only screen and (min-width : 1200px) {/* Styles */}
@media only screen and (min-width : 960px) {/* Styles */}
@media only screen and (min-width : 860px) {/* Styles */}
@media only screen and (min-width : 740px) {/* Styles */}
@media only screen and (min-width : 600px) {/* Styles */}
@media only screen and (min-width : 340px) {/* Styles */}
/* File main.css */
/* Your original styles */
@media (max-width: 960px) {
/* styles 960px and lower */
}
@media (max-width: 560px) {
/* styles 560px and lower */
}
@media (max-width: 659px) {
@import "small"; }
@media (min-width: 661px) (max-width: 959px) {
@import "medium"; }
@media (min-width: 960px) {
@import "original"; }
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min-resolution: 192dpi) and (min-width: 320px),
only screen and ( min-resolution: 2dppx) and (min-width: 320px) {
/* Small screen, retina, stuff to override above media query */
}
@media only screen and (min-width: 700px) {
/* Medium screen, non-retina */
}
@media
only screen and (min-device-pixel-ratio: 2) and (min-width: 700px),
only screen and ( min-resolution: 192dpi) and (min-width: 700px),
only screen and ( min-resolution: 2dppx) and (min-width: 700px) {
/* Medium screen, retina, stuff to override above media query */
}
@media only screen and (min-width: 1300px) {
/* Large screen, non-retina */
}
@media
only screen and (min-device-pixel-ratio: 2) and (min-width: 1300px),
only screen and ( min-resolution: 192dpi) and (min-width: 1300px),
only screen and ( min-resolution: 2dppx) and (min-width: 1300px) {
/* Large screen, retina, stuff to override above media query */
}
<div class="container">
<div class="item">x</div>
<div class="item">x</div>
<div class="item">x</div>
<div class="item">x</div>
</div>
.container {
overflow:hidden;
height:640px;
}
.container .item {
float:left;
}
.container {
display:flex;
}
.container {
display:flex;
flex-direction:row; /*by default*/
:row-reverse;
}
.container {
display:flex;
flex-direction:column;
:column-reverse;
}
.container {
justify-content:flex-start; /* by default */
center;
flex-end;
}
.container {
justify-content:space-between;
space-around;
}
.container {
align-items:flex-start; /* by default */
flex-end;
center;
}
.container .item:nth-child(1) {
align-self:flex-start;
}
.container .item:nth-child(4) {
align-self:flex-end;
}
.container .item {
flex-grow:1;
}
.container div {
flex-grow:1;
}
.container .item:nth-child(1) {
flex-grow:4;
}
.container .item:nth-child(1) {
flex-shrink:4;
}
.container .item {
flex-grow:1;
}
.container .item:nth-child(1) {
flex-basis:250px;
}
.container .item:nth-child(2) {
order:1;
}
.container .item:nth-child(1) { order:2 }
.container .item:nth-child(2) { order:1 }
.container div:nth-child(3) { order:4 }
.container .item:nth-child(4) { order:3 }
.container {
display:flex;
flex-wrap:nowrap; /* by default */
:wrap;
}
.container {
display:flex;
flex-wrap:wrap-reverse;
}
.container {
display:flex;
align-content:stretch; /* by default */
:center;
}
only for multiline!
.container {
display:flex;
align-content:flex-start;
:flex-end;
:flex-between;
:flex-around;
}
E {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
E {
-webkit-box-orient:vertical;
-webkit-box-direction:reverse;
-moz-box-orient:vertical;
-moz-box-direction:reverse;
-ms-flex-direction:column-reverse;
-webkit-flex-direction:column-reverse;
flex-direction:column-reverse;
}
E {
display: table;
}
E .item {
display: table-cell;
width: 50%;
}