project.scss
components/
global/
page-head.scss
pricing-table.scss
image-gallery.scss
home/
quick-search.scss
inuit.css/
pages/
| /* ========================================================================== | |
| Text exposed utility | |
| ========================================================================== */ | |
| /** | |
| * Hides/shows text (use case: "read more" link) | |
| * | |
| * When `u-textExposed` has class `u-textExposed--expose`: | |
| * Shows `u-textExposed-show` | |
| * Hides `u-textExposed-hide` |
| %myclass | |
| color: blue | |
| @media (min-width: 600px) | |
| background: red | |
| @media (min-width: 800px) | |
| font-size: 28px | |
| .class1 | |
| @media (min-width: 600px) | |
| @extend %myclass |
project.scss
components/
global/
page-head.scss
pricing-table.scss
image-gallery.scss
home/
quick-search.scss
inuit.css/
pages/
SUIT: Smart User Interface Toolkit
Principles:
NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
| // Ever needed to escape '\n' as '\\n'? This function does that for any character, | |
| // using hex and/or Unicode escape sequences (whichever are shortest). | |
| // Demo: http://mothereff.in/js-escapes | |
| function unicodeEscape(str) { | |
| return str.replace(/[\s\S]/g, function(character) { | |
| var escape = character.charCodeAt().toString(16), | |
| longhand = escape.length > 2; | |
| return '\\' + (longhand ? 'u' : 'x') + ('0000' + escape).slice(longhand ? -4 : -2); | |
| }); | |
| } |
| /* | |
| * Normalized hide address bar for iOS & Android | |
| * (c) Scott Jehl, scottjehl.com | |
| * MIT License | |
| */ | |
| (function( win ){ | |
| var doc = win.document; | |
| // If there's a hash, or addEventListener is undefined, stop here | |
| if( !location.hash && win.addEventListener ){ |
There seems to be a difference between longhand properties (e.g. background-color) and shorthand properties (e.g. background). Some CSS hacks only work for one or the other. I’ve updated my test case to test these separately, and there are some interesting results.
The following hacks target IE8 but not IE9:
longhandproperty: \0value\0;longhandproperty: \0value;In practice, you might use these like so:
background-color: \0red\0;| // Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/ | |
| var metas = document.getElementsByTagName('meta'); | |
| var i; | |
| if (navigator.userAgent.match(/iPhone/i)) { | |
| for (i=0; i<metas.length; i++) { | |
| if (metas[i].name == "viewport") { | |
| metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0"; | |
| } | |
| } |