By Daigo Fujiwara daigofuji
Use the arrow keys to navigate.
Thanks! Kianosh, NGP VAN, Cascaders!
Remember Macromedia Freehand and Macromedia Flash? I do.
But,
user-scalable=no
or maximum-scale=1
do you use them anymore?
(You probably let them zoom.)
Why does the 640px × 960px iPhone 4 claim to be 320px × 480px in the browser? The truth is that there are two different definitions of pixels: they can be the smallest unit a screen can support (a hardware pixel) or a pixel can be based on an optically consistent unit called a “reference pixel.”— A Pixel Identity Crisis by Scott Kellum, January 17, 2012 on A List Apart
Illustration of “reference pixel”
or what I like to call “CSS pixel”
I am not talking about just Apple “Retina” display
Examples include Google Chromebook Pixel
(and that was already over a year ago!):
(Those devices report as CSS Pixel Ratio of 3)
Don’t get me started…
Apple's Developer Guide(Well, some of many solutions)
(SVG from RaphaelJS icons)
Vector graphics is the use of geometrical primitives such as points, lines, curves, and shapes or polygons—all of which are based on mathematical expressions—to represent images in computer graphics.
From Wikipedia
TL;DR: Pretty good.
Support for Web Open Font Format (WOFF)
We do have to include multiple font formats, specifically
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff') format('woff'), /* Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
— From Chris Coyer of css-tricks
@font-face {
font-family: 'MyWebFont';
src: url('webfont.woff') format('woff');
}
Nice.
Upload .otf or .ttf, get different formats. (Please make sure you have an appropriate license!)
@font-face {
font-family: 'myfont';
src: url('myfont-Regular-webfont.woff') format('woff');
font-weight: normal; font-style: normal;
}
@font-face {
font-family: 'myfont';
src: url('myfont-Italic-webfont.woff') format('woff');
font-weight: normal; font-style: italic;
}
@font-face {
font-family: 'myfont';
src: url('myfont-Bold-webfont.woff') format('woff');
font-weight: bold; font-style: normal;
}
@font-face {
font-family: 'myfont';
src: url('myfont-BoldItalic-webfont.woff') format('woff');
font-weight: bold; font-style: italic;
}
and a lot more...
Image from github’s Octicons
Those are all in the docs
Can edit .otf format fonts
Great post by github engineering team on how they created Octicon.
I created a font called BB Club Font for a hackathon
Use apps like Fontello
or
Doc on how to import
An excellent write up by Dale Sande, on how to organize and manage custom icon fonts. https://gist.github.com/blackfalcon/4731881
He has written Sass icon fonts mixin, which is available via bower.
Link to his SassMeister Demo
XML-based vector image format -- open standards, spec’ed by W3C (This above is an inline svg).
For IE8, use polyfills like SVGWeb, or try simple fallbacks, or better yet, if (!Modernizr.svg)
Chris Coyer from css-tricks has written an awesome article on how to do this.
Basically, load the combined svg (he used grunt to combine multiple files into one) up front, then use
<svg viewBox="0 0 100 100" class="iconclass"><use xlink:href="#id"></use></svg>
anywhere in the code. You can use class to change svg properties like fills, strokes etc.
New CSS-Tricks.com use this for its tab.
SVG can be contained within a containing box like this, much like video elements, to keep proportions. You can also put media query right inside the SVG..
Using aforementioned RaphaelJS icons, you can embed any icons like this:
url("data:image/svg+xml,<svg viewBox='0 0 40 40' height='25' width='25' xmlns='http://www.w3.org/2000/svg'><path fill='rgb(91, 183, 91)' d='M2.379, 14.729L5.208,11.899L12.958,19.648L25.877,6.733L28.707,9.561L12.958,25.308Z' /></svg>")
Convert any vector into web ready css/svg.
As I was giving the talk, Kianosh pointed out that Chris Coyer of CSS-Tricks have *just* published a blog post titled: Inline SVG vs Icon Fonts [CAGEMATCH]. His conclusion:
If you can go IE 9+ / Android 3+, inline SVG is better at pretty much everything than icon fonts. If you need the deeper browser support, I feel like an inline SVG fallback would be too big of a pain to be worth it.
Definitely worth a read if you are interested in this topic.
Open Discussion.
daigo@daigofujiwara.com