On Github cecyc / GDI---Intro-to-RWD
Updated 5/30/2015
Instructor: Cecy Correa, @cecycorrea
Contact: cecy@girldevelopit.com
A litle bit about yourself and what you hope to get out of this class.
What is responsive design?
What is mobile-first?
We'll talk about these in more detail later!
Facebook without Javascript & CSS is hardly usable.
This will make more sense later, I promise!
Presentation by Bryan Rieger (2010)
Slide 56
Techniques that include fluid layouts, flexible images and media queries.
An approach that takes into consideration the lowest-common denominator.
It's asking yourself as a designer: "What is the most important thing users need to do on this site?" and making that as accessible as possible.
Responsive design is a way to achieve mobile-first.
Slide 79
Formula: Target / Context
Wherein...
Target = 640, context is 960
What will the percentage be?
Answer: 66.666666666667%
Let's turn the rest into %
Let's turn the rest into %
*Round up to 4% to make it fit
How do we turn the Context into a %?
Go here:
Videos, images, etc.
The secret again is using %
Secret sauce:
img { max-width: 100%; }
Let's add images to our practice site!
img src="http://placekitten.com/700/200" alt="kitten"
Now, let's add...
img { max-width: 100%; }
What if we want to make it smaller?
Add a class to it!
.cat { width: 50%; }
Add 3 cat images to your site, make them sit side by side using %
Allow you check for capabilities of a device, like:
@media all
Applies to all media types: screen, print, tv...
@media screen
The one you want to use! Browsers and mobile devices are in this category. Excludes print, etc.
@media print
For printers
@media handheld
For "handheld" devices. Not widely supported right now.
@media screen and (resolution: #dpi)
For high resolution devices, like retina displays. You can use this to display higher res images to higher res devices.
@media all and (orientation: landscape)
@media all and (orientation: portrait)
There's even...
@media 3d-glasses
You may see...
@media only screen ...
"Only" is used so older browsers ignore the code.
This will only work in devices:
@media screen and (min-device-width)
This will work in your browser:
@media screen and (min-width)
Add a media query to your site: make the background red at 600px.
@media screen and (min-width: 600px) { body {background: red;} }
Not px but ems
16px is default for browsers.
Target / 16px = em
Let's figure out our ems on our practice site!