cfarm.co/rwd3
How do we make things stack?
How do we make columns for larger screen sizes that have room for them?
These can be based on popular device sizes, like iPhone, iPad and desktop resolutions:
.container { width: 100%; }
@media only screen and (min-width:320px) {
.container {
margin: 0 auto;
width: 320px;
}
}
@media only screen and (min-width: 768px) {
.container {
width: 768px;
}
}
@media only screen and (min-width: 960px) {
.container {
width: 960px;
}
}
Example: Eataly
Some computers have different resolution density. You can target displays on iPhones and iPads, for example:
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.logo {
background-image: ('logo_retina.png');
}
}
If you use this for images, you also need to change the background-size property:
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.logo {
background-image: url('logo_retina.png');
background-size: 100%;
}
}
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.logo {
background-image: url('logo_retina.png');
background-size: 100%;
}
}
Breakpoints can also be more fluid, and added only where the layout starts to look funky:
.hero-image { width: 100%; }
@media only screen and (min-width:530px) {
.container {
float: left;
width: 41.6666666666667%; /* 400px/960px */;
}
}
Example: BohConf
Best practices recommended by the W3C:
User Experience: Ensure that content provided by accessing a URI yields a thematically coherent experience when accessed from different devices.
Testing: Carry out testing on actual devices as well as emulators.
Layout: Use percentage and relative measures such as ems.
Markup: Organize documents so that if necessary they may be read without style sheets.
Content: Limit content to what the user has requested.
Content: Limit content to what the user has requested.
Content: Ensure that material that is central to the meaning of the page precedes material that is not.
Navigation Best practices recommended by the W3C:
All touchable items on the page should be at least around 40x40pts, and should be at least around 10pts away from other touchable items.(Considerations for Mobile Design [Part 3: Behavior])
Your controls need to facilitate touch interaction. This might mean giving links in content body extra padding so they’re easier to tap. This might also mean you need to add extra space between items in an ordered list of links.(Considerations for Mobile Design [Part 3: Behavior])
Touchable items should look like touchable items on handheld devices.(Considerations for Mobile Design [Part 3: Behavior])
Style nav links or callout links as buttons with borders, bolded text & background colors that stand out from other non-nagivation links and text.