Pralie Dutzel
Lead front-end developer and indie game designer.
RWD Article from A List Apart in 2010
@media (min-width: 320px) { ... }
@media (min-width: 568px) { ... }
@media (min-width: 768px) { ... }
@media (min-width: 1024px) { ... }
/* iPhone 5 portrait */
@media (min-width: 320px) { ... }
/* iPhone 5 landscape */
@media (min-width: 568px) { ... }
/* iPad portrait */
@media (min-width: 768px) { ... }
/* iPad landscape */
@media (min-width: 1024px) { ... }
Photo by Brad Frost
/* Defined variable based on trends in common breakpoints */
@media screen and (min-width: $bp-md) { ... }
/* Custom breakpoint specific to its context */
@media screen and (min-width: 1140px) { ... }
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
<article class="media">
<div class="media__figure">
<img src="" alt="">
</div>
<div class="media__content">
<h2>Title</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
</div>
</article>
.media {
display: flex;
flex-wrap: wrap; /* default is nowrap */
}
.media__figure {
margin-right: 1em;
}
.media__content {
flex: 1;
}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
.item { width: 100%; }
@media (min-width: 40em) {
width: 50%;
float: left;
}
@media (min-width: 40em) {
width: 50%;
float: left;
}
<div class="row">
<div class="col-md-6">...</div>
<div class="col-md-6">...</div>
</div>
@media (min-width: 40em) {
.item:nth-child(2n+1) {
clear: left;
}
}
@media (min-width: 40em) {
.item:nth-child(2n+1) {
clear: left;
}
}
@media (min-width: 40em) {
.item:nth-child(2n+1) {
clear: left;
}
}
@media (min-width: 64em) {
width: 33.333%;
}
@media (min-width: 64em) {
width: 33.333%;
}
@media (min-width: 64em) {
width: 33.333%;
}
@media (min-width: 40em) {
.item:nth-child(2n+1) {
clear: left;
}
}
@media (min-width: 40em) {
.item:nth-child(2n+1) {
clear: left;
}
}
@media (min-width: 40em) {
.item:nth-child(2n+1) {
clear: left;
}
}
@media screen and (min-width: 40em) and (max-width: 64em) {
.item:nth-child(2n+1) {
clear: left;
}
}
@media (min-width: 64em) {
.item:nth-child(3n+1) {
clear: left;
}
}
@media (min-width: 64em) {
.item:nth-child(3n+1) {
clear: left;
}
}
@media (min-width: 64em) {
.item:nth-child(3n+1) {
clear: left;
}
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item:first-child { width: 100%; }
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item:first-child { width: 100%; }
.item:nth-child(n+2):nth-child(-n+3) {
width: 50%;
}
.item:nth-child(n+2):nth-child(-n+3) {
width: 50%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item {
width: 33.333%;
}
.item:last-child:nth-child(3n+2) {
width: 50%;
}
.item:last-child:nth-child(3n+1) {
width: 100%;
}
By Pralie Dutzel
With such a wide array of screen resolutions and devices, there's a lot more to consider when building responsive websites than just "desktop" and "mobile". In this talk, we'll cover the importance of content-centric breakpoints over device-centric ones, and discuss design patterns and tricks to help you level up your sites' responsiveness.