@mrjyn
July 19, 2011
July 18, 2011
World P's
Jon Tangerine.
Pith & pulp ← This is not an image, it's just a typographic folly.
!
!"
"#
#$
$%
%&
&'
'(
()
)*
*+
+,
,-
-.
./
/0
01
12
23
34
45
56
67
78
89
9:
:;
;<
<=
=>
>?
?@
@A
AB
BC
CD
DE
EF
FG
GH
HI
IJ
JK
KL
LM
MN
NO
OP
PQ
QR
RS
ST
TU
UV
VW
WX
XY
YZ
Z[
[\
\]
]^
^_
_`
`a
ab
bc
cd
de
ef
fg
gh
hi
ij
jk
kl
lm
mn
no
op
pq
qr
rs
st
tu
uv
vw
wx
xy
yz
z{
{|
|}
}~
~ 
£
£§
§©
©­
®
®°
°´
´½
½Ä
ÄÅ
ÅÖ
ÖØ
ØÜ
Üä
äå
åö
ö÷
÷ø
øü
üˆ
ˆ˚
˚˜
˜˝
˝‗
‗‚
‚†
†‰
‰′
′‹
‹›
›⁄
⁄€
€™
™≈
≈◦
◦☺
☺☼
☼♀
♀♂
♂♥
♥
Installing Webfonts
Webfonts are supported by all major browser platforms but not all in the same way. There are currently four different font formats that must be included in order to target all browsers. This includes TTF, WOFF, EOT and SVG.
1. Upload your webfonts
You must upload your webfont kit to your website. They should be in or near the same directory as your CSS files.
2. Include the webfont stylesheet
A special CSS @font-face declaration helps the various browsers select the appropriate font it needs without causing you a bunch of headaches. Learn more about this syntax by reading the Fontspring blog post about it. The code for it is as follows:
/>
3. Modify your own stylesheet
To take advantage of your new fonts, you must tell your stylesheet to use them. Look at the original @font-face declaration above and find the property called "font-family." The name linked there will be what you use to reference the font. Prepend that webfont name to the font stack in the "font-family" property, inside the selector you want to change. For example:
p { font-family: 'WebFont', Arial, sans-serif; }
4. Test
Getting webfonts to work cross-browser can be tricky. Use the information in the sidebar to help you if you find that fonts aren't loading in a particular browser.
Troubleshooting
Font-Face Problems
Having trouble getting your webfonts to load in your new website? Here are some tips to sort out what might be the problem.
Fonts not showing in any browser
This sounds like you need to work on the plumbing. You either did not upload the fonts to the correct directory, or you did not link the fonts properly in the CSS. If you've confirmed that all this is correct and you still have a problem, take a look at your .htaccess file and see if requests are getting intercepted.
Fonts not loading in iPhone or iPad
The most common problem here is that you are serving the fonts from an IIS server. IIS refuses to serve files that have unknown MIME types. If that is the case, you must set the MIME type for SVG to "image/svg+xml" in the server settings. Follow these instructions from Microsoft if you need help.
Fonts not loading in Firefox
The primary reason for this failure? You are still using a version Firefox older than 3.5. So upgrade already! If that isn't it, then you are very likely serving fonts from a different domain. Firefox requires that all font assets be served from the same domain. Lastly it is possible that you need to add WOFF to your list of MIME types (if you are serving via IIS.)
Fonts not loading in IE
Are you looking at Internet Explorer on an actual Windows machine or are you cheating by using a service like Adobe BrowserLab? Many of these screenshot services do not render @font-face for IE. Best to test it on a real machine.
Fonts not loading in IE9
IE9, like Firefox, requires that fonts be served from the same domain as the website. Make sure that is the case.
©2010-2011 Font Squirrel. All rights reserved.
AaBb J o n T a n g e r i n e . Pith & pulp ← This is not an image, it's just a typographic folly. ! ! " " # # $ $ % % & & ' ' ( ( ) ) * * + + , , - - . . / / 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 : : ; ; < < = = > > ? ? @ @ A A B B C C D D E E F F G G H H I I J J K K L L M M N N O O P P Q Q R ...»See Ya
Nicolas Gallagherstein
Fluid faux columns without images. Source independent. The use of rgba background is only to show the area of each box. No problem putting links in the content ( #non ). The markup for this section looks like this: ---------------------- Supp2: Third in source ---------------------- Sed accumsan neque a nisi luctus volutpat. Quisque placerat nibh ac leo varius non varius lacus cursus. Curabitur bibendum volutpat eleifend. Nullam sit amet dolor massa. Nunc consectetur ornare purus, et euismod nunc cursus at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec aliquet leo nec quam vestibulum non mattis odio dapibus. Curabitur consequat odio odio. Proin a justo at lorem ultricies hendrerit. Sed accumsan neque a nisi luctus volutpat. Quisque placerat nibh ac leo varius non varius lacus cursus. Curabitur bibendum volutpat eleifend. Nullam sit amet dolor massa. Nunc consectetur ornare purus, et euismod nunc cursus at. Vestibulum ante ipsum primis in faucibus orci. Dribbble style buttons without images ( http://dribbble.com ) This example uses one element and one image (a sprite). Using pseudo-elements for additional background-images lets you clip sprites and fake the positioning of a background image from any side (not just the top and left). [content] Images that break out of the box are a popular effect. This is easy to achieve with pseudo-elements. No need for images in the markup, nested elements, or empty elements. Depending on the look you're after you can absolutely position or float the pseudo-element. This technique gives you a lot of flexibility over the positioning of presentational imagery. They can be part of the normal flow; or content can flow around them (float); or they can be removed from the document flow entirely and positioned from any side (absolute/fixed positioning). This example floats the pseudo-element so the main content's text will wrap around this image. [content] [content] An element with the popular folded-corner effect (with CSS only), two background images, and a generated-content image. P.S. Don't let your designer friends see my comic sans [content] You can find me on twitter ( http://twitter.com/necolas ). Multiple Backgrounds and Borders with CSS 2.1. You'll have to view the CSS file because Firebug won't show pseudo-elements.Nicolas Gallagher
********************************* Multiple Backgrounds demo for Silverback ( http://silverbackapp.com/ )'s parallax effect with more gorillas. [content] --------------------- Main: First in source ---------------------
Fit for purpose
Resize your browser. How wide am I?
<div id="silverback">[content]</div>
Main: First in source
Fluid faux columns without images. Source independent. The use of rgba
background is only to show the area of each box.
No problem putting links in the content. The markup for this section looks like this:
Multiple Borders with CSS 2.1
By Nicolas Gallagher
Multiple Borders demo for Multiple Backgrounds and Borders with CSS 2.1. You'll have to view the CSS file because Firebug won't show pseudo-elements.
Fit for purpose: Firefox 3.5+, Safari 4+, Chrome 4+, Opera 10+, Internet Explorer 8+.
div
containing some contentdiv
containing some contentdiv
containing some contentdiv
containing some contentA div
with at least one child element provides 7 "borders".
FABW's complex borders
No images used to create these borders
Vivamus auctor, tellus vel dictum pulvinar, a congue elit odio vel enim. Quisque fringilla semper fermentum. Nulla a felis a diam dapibus accumsan.
Supp1: Second in source
Vivamus auctor, tellus vel dictum pulvinar, a congue elit odio vel enim. Quisque fringilla semper fermentum. Nulla a felis a diam dapibus accumsan. Etiam varius fringilla magna sit amet hendrerit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Supp2: Third in source
Sed accumsan neque a nisi luctus volutpat. Quisque placerat nibh ac leo varius non varius lacus cursus. Curabitur bibendum volutpat eleifend. Nullam sit amet dolor massa. Nunc consectetur ornare purus, et euismod nunc cursus at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec aliquet leo nec quam vestibulum non mattis odio dapibus. Curabitur consequat odio odio. Proin a justo at lorem ultricies hendrerit.
Sed accumsan neque a nisi luctus volutpat. Quisque placerat nibh ac leo varius non varius lacus cursus. Curabitur bibendum volutpat eleifend. Nullam sit amet dolor massa. Nunc consectetur ornare purus, et euismod nunc cursus at. Vestibulum ante ipsum primis in faucibus orci.
This example uses one element and one image (a sprite).
Using pseudo-elements for additional background-images lets you clip sprites and fake the positioning of a background image from any side (not just the top and left).
<div id="sprite">[content]</div>
The background can even live outside the box
Images that break out of the box are a popular effect. This is easy to achieve with pseudo-elements. No need for images in the markup, nested elements, or empty elements.
Depending on the look you're after you can absolutely position or float the pseudo-element. This technique gives you a lot of flexibility over the positioning of presentational imagery. They can be part of the normal flow; or content can flow around them (float); or they can be removed from the document flow entirely and positioned from any side (absolute/fixed positioning).
This example floats the pseudo-element so the main content's text will wrap around this image.
<div id="outside"> <div class="hero">[content]</div> <div class="main">[content]</div> </div>
An element with the popular folded-corner effect (with CSS only), two background images, and a generated-content image.
P.S. Don't let your designer friends see my comic sans
<div id="corner">[content]</div>
Jquery for Designers uses nested div
's and 3 images on its About page to create this effect. Using pseudo-elements as background canvases, just one element is needed.
<div id="j4d">[content]</div>
Read the article: Multiple Backgrounds and Borders with CSS 2.1.
About me
I'm a London-based freelance Front-End Web Developer, CSS researcher and hacker, co-creator of Normalize.css, and contributor to the HTML5 Boilerplate project.
The organisations I've done work for include ASOS, Central Office of Information, The Department of Health, Arthritis Research UK, Natural England, and UCL. Further information is available in my résumé.
This is my personal blog. I write here – usually on topics related to front-end development – as part of engaging with, and learning from, other developers.
nicolas@nicolasgallagher.com. Copyright © 2011 Nicolas Gallagher.
Original code is dual licensed under the MIT and GNU GPLv2 licenses. Original photographs and text are licensed under a Creative Commons BY-SA license.Vivamus auctor, tellus vel dictum pulvinar, a congue elit odio vel enim. Quisque fringilla semper fermentum.