Adaptive Design and Progressive Enhancement Flashcards
How many media queries do you need?
Personally, I add a media query when my site breaks an I need one. I also validate against client needs. If my client is on an iPhone 4, I’ll make sure it works on that device.
However, here are a few best practice breakpoints based on the Bootstrap framework:
/* Extra small devices (phones, less than 768px) */ /* Small devices (tablets, 768px and up) */ /* Medium devices (desktops, 992px and up) */ /* Large devices (large desktops, 1200px and up) */
The pure framework uses:
@media screen and (min-width: 35.5em) ≥ 568px
@media screen and (min-width: 48em) ≥ 768px
@media screen and (min-width: 64em) ≥ 1024px
@media screen and (min-width: 80em) ≥ 1280px
Different browsers have different default styles. A reset CSS _________ the differences so that all elements are initially styled the same way. This allows developers to start from ________ ground across __________.
Different browsers have different defualt styles. A reset CSS normalizes the differences so that all elements are initially styled the same way. This allows developers to start from common ground across browsers.
http://meyerweb.com/eric/tools/css/reset/
__________ _________ are used to apply ________ code (including stylesheets) for different browsers. You can conditionally load ________ files in the same manner.
Conditional comments are used to apply different code (including stylesheets) for different browsers. You can conditionally load JavaScript files in the same manner.
Give an example of conditional comments:
//applpies only to IE8 //applies to IE7 and less. Properties trickle down to IE6
http://html5boilerplate.com/ makes use of these quite effectively. See http://www.youtube.com/watch?v=qyM37XKkmKQ for more on HTML5 boilerplate.
CSS is read and applied from _____ to _______. Styles applied at the top would be read and applied _____. If less ________ styles are applied last, modern browsers would use it. Older browsers would not and your CSS code would be more organized.
Older browsers may completely ignore ______ it does not understand and if there is valid ______ after, that may be ignored as well.
CSS is read and applied from top to bottom. Styles applied at the top would be read and applied first. If less standard styles are applied last, modern browsers would use it. Older browsers would not and your CSS code would be more organized.
Older browsers may completely ignore CSS it does not understand and if there is valid CSS after, that may be ignored as well.
Apply standard styles first code:
/* <= IE 6 */ body { margin: 0; text-align: center; background: #600 none; } /* IE 7, Mozilla, Safari, Opera */ body[id=css-zen-garden] { margin: 100px 0 0; padding: 0; text-align: center; background: transparent url(squidback.gif); }
JavaScript can check the ______ ______, somewhat unreliably, to determine the _______ being used. Based on that knowledge, classes can be _____, ______, or _______ dynamically. As mentioned the ______ _________ ids not a foolproof way of checking what browser is being used.
JavaScript can check the User Agent, somewhat unreliably, to determine the browser being used. Based on that knowledge, classes can be added, removed, or changed dynamically. As mentioned the User Agent ids not a foolproof way of checking what browser is being used.
Some browsers have specific ______ properties that may be applied.
Some browsers have specific CSS properties that may be applied
Hacks are ______ and ____ recommended but they do exist.
Hacks are ugly and not recommended but they do exist.
See more at:
http: //css-tricks.com/snippets/css/browser-specific-hacks/
http: //browserhacks.com/
Here are some examples.
/*Works for Firefox */ @-moz-document url-prefix() { #my-id { font-size: 100%; } }
/* IE7, IE8 */ #veinte { color/*\**/: blue\9; }
/*YUCK...*/ JavaScript
Different ________ and ________ allow for different JavaScript ________. In fact, some users who access your page (including non-human readers) may not have JavaScript enabled. Developers should establish a baseline to ensure that the most basic device/browser accessing the page is served the required content.
Different devices and browsers allow for different JavaScript functionality. In fact, some users who access your page (including non-human readers) may not have JavaScript enabled. Developers should establish a baseline to ensure that the most basic device/browser accessing the page is served the required content.
window.matchMedia can be used for _______ _______ _______ the same way that media queries fork CSS rules.
matchMedia uses the same _____ of the actual media query.
window.matchMedia can be used for fork JavaScript functionality the same way that media queries fork CSS rules.
matchMedia uses the same syntax of the actual media query.
https://hacks.mozilla.org/2012/06/using-window-matchmedia-to-do-media-queries-in-javascript/
Use JavaScript’s _______.________() when you want to execute different JavaScript based on media queries.
You’re not replacing CSS media queries.
CSS is for ______ and ______. JavaScript is for ________.
Use JavaScript’s window.matchMedia() when you want to execute different JavaScript based on media queries.
You’re not replacing CSS media queries.
CSS is for design and layout. JavaScript is for functionality
The aim of _________ JavaScript is to clearly separate functionality from ________ and ______/______.
For starters, that means that all scripts should, as much as possible, be held in _________ files. No _______ _______ handlers or _______ _______ elements.
If your JavaScript modifies style, it is best to add or remove classes instead of updating style properties.
The aim of Unobtrusive JavaScript is to clearly separate functionality from content and design/layout.
For starters, that means that all scripts should, as much as possible, be held in external files. No inline event handlers or embedded script elements.
If your JavaScript modifies style, it is best to add or remove classes instead of updating style properties.
Some _______ and _______ are different and may not support your app’s needs (partially or entirely). TEST on your devices/browsers.
In the case of the browser’s capabilities, check to see if target ________ and ________ exist. If they do not, you also have the option of handling that case gracefully.
________ _______ is recommended over browser detection.
Some devices and browser are different and may not support your app’s needs (partially or entirely). TEST on your devices/browsers.
In the case of the browser’s capabilities, check to see if target objects and functions exist. If they do not, you also have the option of handling that case gracefully.
Capability detection is recommended over browser detection.