<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ilia Draznin Online &#187; css</title>
	<atom:link href="http://iliadraznin.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://iliadraznin.com</link>
	<description>javascript • css • html5 &#38; ajax • art &#38; design • technology</description>
	<lastBuildDate>Sun, 29 Aug 2010 15:46:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Joomla Toolbar fix</title>
		<link>http://iliadraznin.com/2010/08/joomla-toolbar-fix/</link>
		<comments>http://iliadraznin.com/2010/08/joomla-toolbar-fix/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 02:06:22 +0000</pubDate>
		<dc:creator>Ilia</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css tips]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://iliadraznin.com/?p=278</guid>
		<description><![CDATA[If you work with Joomla 1.5 and like me, find the right alignment of toolbar icons counterproductive (in the default admin theme), then you can fix it with just a few CSS tweaks. Here’s what I mean. To do this, in Joomla’s root folder go to administrator/templates/khepri/css. In file rounded.css find the style for div.m [...]]]></description>
			<content:encoded><![CDATA[<p>If you work with Joomla 1.5 and like me, find the right alignment of toolbar icons counterproductive (in the default admin theme), then you can fix it with just a few CSS tweaks. Here’s what I mean.</p>
<p><a href="http://iliadraznin.com/wp/wp-content/uploads/2010/08/joommenufix.png"><img class="alignnone size-medium wp-image-279" title="joommenufix" src="http://iliadraznin.com/wp/wp-content/uploads/2010/08/joommenufix-300x55.png" alt="joomla menu fix" width="300" height="55" /></a></p>
<p>To do this, in Joomla’s root folder go to <i>administrator/templates/khepri/css</i>. In file <b>rounded.css</b> find the style for <b>div.m</b> and add <b>position:relative</b> to it. That’s it for that file. Now open the file <b>general.css</b> and that’s where you’ll need to make several changes. I’ve put the modified styles below — the highlighted lines are the ones that take care of the new, and improved, position; the rest are colors, font sizes, margins, etc., basically stuff you can adjust to your liking.</p>
<pre class="brush:css; highlight:[6,7,13,22]">
div.header {
	font-size:20px;
	font-weight:bold;
	color:#0b55c4;
	background-repeat:no-repeat;
	position:absolute;
	top:0px; left:4px;
	padding-left:30px;
	-moz-background-size:auto 100%;
	-webkit-background-size:auto 100%;
}
div.toolbar {
	float:left;
	text-align:right;
	padding:0;
	margin-top:26px;
}
table.toolbar td { padding:1px 1px 1px 4px; text-align:center; color:#666; height:24px; }
table.toolbar span {
	display:block;
	width:20px; height:20px;
	float:left;
	margin-right:4px;
	-moz-background-size:100%;
	-webkit-background-size:100%;
}
table.toolbar a {
	display:block;
	float:left;
	white-space:nowrap;
	line-height:22px;
	border:1px solid #fbfbfb;
	padding:1px 6px 0px;
	background:#fdfdfd;
	-moz-border-radius:6px;
	-webkit-border-radius:6px;
	-moz-box-shadow:rgba(0,0,0,.3) 0 0 4px;
	-webkit-box-shadow:rgba(0,0,0,.3) 0 0 4px;
	border:1px solid #fff;
	color:#0b55c4;
}
table.toolbar a:hover { border-color:#ccc; text-decoration:none; background:#fff; }
</pre>
<p>Obviously these would work best in Firefox or Chrome, but the new position should work in IE as well. The biggest issue you’re going to have in IE is that the icons will not scale (since the styles are using background-size to rescale them to smaller dimensions), and they’ll be cutoff.</p>
<p>This will also work with the Joomla 1.6 and the new default theme Bluestork. You’ll be working with file template.css, and instead of .header it’s going to be .pagetitle, and instead of table with cells it’ll be an unordered list.</p>
<p>Personally I find this style of menu much easier to work with, not to mention that it’s a bit more compact.</p>
]]></content:encoded>
			<wfw:commentRss>http://iliadraznin.com/2010/08/joomla-toolbar-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom AddThis share button</title>
		<link>http://iliadraznin.com/2010/07/custom-addthis-share-button/</link>
		<comments>http://iliadraznin.com/2010/07/custom-addthis-share-button/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 01:46:21 +0000</pubDate>
		<dc:creator>Ilia</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://iliadraznin.com/?p=272</guid>
		<description><![CDATA[I wanted to have an AddThis share button that would fit better with the site’s design, and if you’re reading this post on its own page you can scroll down and see what I mean. While AddThis provides plenty of ways to customize their buttons, there is no way to assign your own image to [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to have an AddThis share button that would fit better with the site’s design, and if you’re reading this post on its own page you can scroll down and see what I mean. While AddThis provides plenty of ways to customize their buttons, there is no way to assign your own image to the icon, which means doing it the hard way… well, relatively speaking of course.</p>
<p>There are three main steps to creating a customized share button. There’s some javascript to include in the footer.php, few lines of html to add at the end of your posts, and of course some styles and the icon itself.<br />
<span id="more-272"></span></p>
<h3>JavaScript</h3>
<p>You’ll want to add this js code in the footer file as probably the last piece of code. This means it won’t be loading until everything else is done. You can read detailed explanation of what you can do on <a href="http://www.addthis.com/help/client-api" target="_blank" rel="external nofollow">AddThis’ API page</a> but the short of it is — include this script file <b>“http://s7.addthis.com/js/250/addthis_widget.js”</b>. If you want to keep track of various stats AddThis provides, you’ll need to provide your username. This is done with the “addthis_config” variable. So for example, what I have is</p>
<pre class="brush:js">
&lt;script type=&quot;text/javascript&quot;&gt;
var addthis_config = { username:&quot;2late2die&quot;, data_track_clickback:true };
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://s7.addthis.com/js/250/addthis_widget.js&quot;&gt;&lt;/script&gt;
</pre>
<h3>HTML</h3>
<p>The HTML is pretty much just a regular link, but with certain href target, class and a couple of special addthis attributes. You can style it anyway you want, as you would any other link. Here’s how said link might look</p>
<pre class="brush:php; html-script:true; gutter:false">
&lt;a href=&quot;http://www.addthis.com/bookmark.php?v=250&amp;amp;username=[username]&quot;
  class=&quot;addthis_button&quot; addthis:url=&quot;&lt;?php the_permalink() ?&gt;&quot;
  addthis:title=&quot;&lt;?php the_title_attribute() ?&gt;&quot;&gt;Share&lt;/a&gt;
</pre>
<p><b>“http://www.addthis.com/bookmark.php?v=250&amp;username=[your username here]”</b> is the url the link should be pointing to. It must have the “addthis_button” class, otherwise AddThis js won’t recognize it, and then the <b>addthis:url</b> and <b>addthis:title</b> attributes. These attributes are self explanatory, just remember to use PHP so that they are assigned dynamic values. If you have any code, or plugins, that insert tags with attributes or class names into the title (like in my case, wp-typography, which puts <code>&lt;span class=&quot;caps&quot;&gt;</code> around any caps-only words, like acronyms and such) then use the “the_title_attribute()” function, instead of the typical “the_title()”. It strips the tags and escapes any problematic characters.</p>
<h3>CSS</h3>
<p>This is really all up to you, depending on how you want to style the button and the tooltips with the various sites. By default the AddThis scripts provides its own style, so if you don’t mind the white tooltip box, all you’ll need to style is the link itself. If you want to style the tooltips as well, then you’ll need to dig into the generated code for them and the styles used by default, and figure out which ones you want to change. (You can check out my styles to see how I gave it a dark theme by switching a few colors.)</p>
<p>If you like optimizing your code you might decide to not include the AddThis styles file at all. You can do this by adding “ui_use_css:false” to “addthis_config”, i.e.</p>
<pre class="brush:js; gutter:false">
var addthis_config = { ui_use_css:false };
</pre>
<p>That CSS file weighs in at about 52k, which is actually quite hefty. There are, however, two reasons to keep, instead of removing it.<br />
First of all, by removing it, you will have to provide all the styles to AddThis widget from scratch, as it were, including all those icons for the various services, which are backgrounds of the links, not image tags in the HTML. It’s certainly doable but it’s a hastle that might be not worth it at the end (depending on how anal you are about optimizing your code). The other reason is that, because AddThis is a fairly popular widget, many of your users are likely to have already downloaded that css file when they encountered the AddThis button on other sites. This means it’s cached in the browser and takes little to no time to download.</p>
<p>Now, as for that FB “like” button, looks like it might be tricky…</p>
]]></content:encoded>
			<wfw:commentRss>http://iliadraznin.com/2010/07/custom-addthis-share-button/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Reflections and Accordion using CSS only, in Safari and Firefox</title>
		<link>http://iliadraznin.com/2009/07/reflections-accordion-css-transform-webkit-safari/</link>
		<comments>http://iliadraznin.com/2009/07/reflections-accordion-css-transform-webkit-safari/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 05:20:05 +0000</pubDate>
		<dc:creator>Ilia</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css tips]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[reflect]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[transform]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://iliadraznin.com/?p=64</guid>
		<description><![CDATA[Using combination of CSS transforms, transitions, gradients and :target it’s possible to create things that usually require JavaScript — such as accordion and reflections (in Firefox). Unfortunately, this only works 100% in Safari and Chrome (and I guess any other webkit using browser). In Firefox these elements behave properly, they just don’t have animations or [...]]]></description>
			<content:encoded><![CDATA[<p>Using combination of CSS <strong>transforms</strong>, <strong>transitions</strong>, <strong>gradients</strong> and <strong>:target</strong> it’s possible to create things that usually require JavaScript — such as accordion and reflections (in Firefox). Unfortunately, this only works 100% in Safari and Chrome (and I guess any other webkit using browser). In Firefox these elements behave properly, they just don’t have animations or gradients. As for IE, I didn’t bother with it at all.</p>
<p><a title="Example of Reflections and Accordion in Safari/Chrome" href="http://iliadraznin.com/examples/reflections-accordion-safari/" target="_self">Here is the page</a> I’m going to go over. Feel free to dig into the code and if you’ve got any ideas on how to make it even sleeker let me know.<span id="more-64"></span></p>
<hr />
<p>
<strong>Update:</strong> It’s been brought to my attention that Safari in fact supports actual css reflections in the form of <em>–webkit-box-reflect</em>. It’s very cool as it actually allows for dynamic reflections and you can even reflect video. It is however, much like gradients, a webkit only property and so doesn’t do anything for Firefox reflections.
</p>
<hr />
<h3>Reflections</h3>
<p>Simple reflections are very easy — make a copy of the content, flip it, shift it down and reduce opacity.<br />
To make a copy of the content you have two options, in some cases you can use CSS, and in some you just have to create the content twice in HTML — this may seem “wasteful” but if you think about it, any reflections, JavaScript or otherwise (even native, when/if they come) involve duplicating the content — that’s just the nature of the beast.</p>
<p>To duplicate content in CSS we need to use <em>:after</em> and <em>content</em> (it is somewhat limited though). Here is how I did it for menu links</p>
<pre class="brush:css; html-script:true;">
&lt;a href='#' title='Home'&gt;Home&lt;/a&gt;&lt;/li&gt;

.menu a:after { content:attr(title); }
</pre>
<p><em>:after</em> tells CSS what to add after the current element, and content can take text in quotes or a number of elements (<a href="http://www.w3.org/TR/CSS2/generate.html#content" target="_blank" rel="external nofollow">W3C spec</a>). In this case I use the title attribute of the link, which is exactly the same as the text of the link. The obvious limitation here is that <em>content </em>can’t contain tags, but it can contain URLs to other content (such as image). I also couldn’t see any way to use the text inside the tag (i.e. innerHTML), which I think is an unfortunate omission since that could’ve been quite useful.</p>
<p>The :after element can be styled just like anything else. So, here is the complete style for the menu item reflection</p>
<pre class="brush:css">
.menu a:after {
	content:attr(title);
	display:block;
	width:100%;
	position:absolute;
	bottom:-.88em; left:0;
	opacity:.2;
	text-align:center;
	-moz-transform:scaleY(-1);
	-webkit-transform:scaleY(-1);
}
</pre>
<p>As you can see, I shifted the element, modified its opacity and ‘flipped’ it using scaleY. <a href="https://developer.mozilla.org/en/CSS/-moz-transform" target="_blank" rel="external nofollow">Here is the spec for –moz-transform</a>, it seems to be identical to Safari/Chrome implementation, they just use the –webkit– prefix instead.</p>
<p>Apparently IE has transforms, using <em>filter</em> property. So if you want to use this and need to make this IE compatible, you should be able to achieve at least some of these effects.</p>
<p>The last touch to make reflections perfect is the fade-out, but it’s only possible in Safari and only on solid background. To do this we need to use gradients. Basically you just put a short div alongside the bottom of the container (with the reflected objects) and make it fade from transparent to the background colour (from top to bottom). This will cover part of the reflection and make it look like it fades out. Here is the complete style for this div</p>
<pre class="brush:css">
.reflection-gradient {
	display:block;
	width:100%; height:1.6em;
	position:absolute;
	bottom:0; left:0;
	background:-webkit-gradient(linear, left bottom, left top, color-stop(.2, rgba(35,35,41,1)), to(rgba(35,35,41,0)));
}
</pre>
<p><a href="http://webkit.org/blog/175/introducing-css-gradients/" target="_blank" rel="external nofollow">Here is the breakdown of –webkit-gradient</a>. The short of it is — the first attribute can be “linear” or “radial”; the next two pairs tell the gradient where it goes from and to (if I were to use ‘left bottom, right top’ it would go in a diagonal), next is any number of points where colour changes (i.e. it can be 3, 5, 20 points, etc.). In this case there are only two and they’re telling the browser that, from 0% to 20% of height use colour A, and at 100% height use colour B (“from” and “to” are shortcuts for “color-stop(0,#xxx)” and “color-stop(1,#xxx)” respectively). The thing to note here is that I use rgba colour format, instead of hex, because “transparent” (for the second colour) doesn’t seem to work quite as well — the gradient doesn’t transition properly from transparent to opaque for some reason. Although I think I probably could’ve used hex colour for the first value, but I decided not to mix them up.</p>
<p>One more thing I decided to add to the menu is a bit of animation — as mouse hovers over a menu item it grows a bit. This works in all browsers (since it’s just a font increase) but it’s only animated in Safari/Chrome. The code for that is simple — just add –webkit-transition to the initial style, and in the :hover style make the changes you want, and they’ll be animated. Here are the styles I used for the menu items</p>
<pre class="brush:css">
.menu a {
	display:block;
	position:relative;
	font-size:1.6em;
	padding:0 .8em;
	...
	-webkit-transition: font-size .1s linear;
}

.menu a:hover {
	font-size:2em;
	padding:0 .4em;
	color:#c8c8c8;
}
</pre>
<p>The first property of transition specifies what property triggers the animation. So in this case all the attributes, that were changed (on :hover), will animate but only if font-size is among them. You can use “all” to specify that any attribute can trigger the animation. The next property is the time of the animation, and the last one is the timing function. <a href="http://www.the-art-of-web.com/css/timing-function/" target="_blank" rel="external nofollow">Here is a nice break down of that</a>. I could’ve used scale in this case (instead of font-size), but it didn’t maintain the correct vertical alignment, so I kept it as is. (I change the padding as well to prevent too much shifting around of the other menu items.)</p>
<p>If you check out the example page, you’ll see that there are two menus. The reason for it is that the first one seemed better in my head, but in practise turned out to be more annoying. So I created a variation of it that I think works better (it uses fixed item width), but I decided to leave the first version anyway.</p>
<h3>Accordion</h3>
<p>Accordion uses the <em>:target</em> trick. You know those in-page links like &lt;a href=‘currentpage.html#top’&gt; — apparently, when an item is activated using a link like that it gets the <em>:target</em> property. In other words, let’s say you have a header like this</p>
<pre class="brush:html">
&lt;h2 id='header'&gt;Some title here&lt;/h2&gt;
</pre>
<p>and at the bottom of the page you have a ‘top’ link like this</p>
<pre class="brush:html">
&lt;a href='#header'&gt;Back to top&lt;/a&gt;
</pre>
<p>Then, when you click the “back to top” link, whatever styles are defined in <em>h2:target</em> will be applied to the header.</p>
<p>So then if instead of a header you have a content block with default height/width of 0px, and that block changes its width/height using <em>:target</em> style, then you’re essentially ‘showing’ the content ‘on click’ — pretty nifty ain’t it. Taking it a bit further, stack up (vertically or horizontally) a bunch of links and divs, and have the links target the divs — and voila, you’ve got yourself an accordion.</p>
<p>So that’s how I did the accordion on the example page. The extra “flare” that I added to it is vertical text (using transform, rotate(-90deg)), and for Safari, I also used <em>–webkit-gradient</em> to make the accordion tabs a bit nicer, and <em>–webkit-transition</em> to animate the “opening” and “closing” of the content divs.</p>
<p>Finally, that “gallery” at the bottom of the page uses more or less the same tricks as the menus. I did however run into a problem with it — I couldn’t centre (horizontally) the images, while keeping them “on the floor”. To put them there I had to use absolute positioning (vertical-align:bottom didn’t do the trick for some reason), which doesn’t work with auto-centring (image widths are not consistent) using margin:auto or display:inline-block. If somebody figures it out please let me know.</p>
<p>I find it very cool that all that with new CSS techniques it’s possible to do many of these things without any JavaScript. <img src='http://iliadraznin.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I only hope that Mozilla adds transitions and gradients soon to their CSS engine.</p>
]]></content:encoded>
			<wfw:commentRss>http://iliadraznin.com/2009/07/reflections-accordion-css-transform-webkit-safari/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using CSS3 @font-face to “fake” multiple font weights</title>
		<link>http://iliadraznin.com/2009/07/css3-font-face-multiple-weights/</link>
		<comments>http://iliadraznin.com/2009/07/css3-font-face-multiple-weights/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 01:11:43 +0000</pubDate>
		<dc:creator>Ilia</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css tips]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[fonts]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://iliadraznin.com/?p=28</guid>
		<description><![CDATA[CSS2 specifies additional font weights, beyond Normal and Bold. In particularly there are 9 font weights in total — 100, 200, 300, 400 (normal), 500, 600 (bold), 700, 800 and 900. Unfortunately browsers still somewhat lack support for this feature, but more importantly fonts lack support for this. Many fonts however, still come with only [...]]]></description>
			<content:encoded><![CDATA[<p>CSS2 specifies additional font weights, beyond Normal and Bold. In particularly there are 9 font weights in total — 100, 200, 300, 400 (normal), 500, 600 (bold), 700, 800 and 900. Unfortunately browsers still somewhat lack support for this feature, but more importantly fonts lack support for this. Many fonts however, still come with only normal and bold weights. Moreover, based on a few tests, even professional fonts that come with multiple weights (such as thin, light, regular, bold, heavy, etc.) don’t actually support these weights in the same way as the CSS2 specification dictates, in other words they can’t be used out of the box like that.</p>
<p>For example, I have the Arno Pro font (a nice serif font from Adobe). It comes in 4 weights — regular, bold, light and semibold. Each is encapsulated in its own file with a distinct name, e.g. ArnoPro-Bold, ArnoPro-Smdb, ArnoPro-Light, etc. I don’t know much about how fonts work but based on a bit of reading I’ve done, for a font like that I should be able  to declare a style that uses “ArnoPro” font-family and based on the weight I assign to a particular element it would use a different version. For example, ArnoPro-Light for 200, ArnoPro-Regular for 400 or normal, and so on. However, based on a few tests I’ve done that doesn’t seem to be the case. In fact “ArnoPro” font isn’t recognized at all, only if I specify explicitly “ArnoPro-Smbd” does it recognize the font. And of course when it’s done like that all but the regular version are stuck with one weight, i.e.<strong> font-family:ArnoPro-Smbd; font-weight:normal</strong> looks exactly the same as <strong>font-family:ArnoPro-Smbd; font-weight:bold</strong>.</p>
<p>In short, the situation is less than ideal. However, there may be a at least a partial fix.</p>
<p>Using @font-face, which was introduced in CSS3, you can simulate the extra font-weights by assigning the specific fonts to  each weight. This is a kind of a hack, and one that will not work in all browsers. In fact, I only managed to get it to work in FF3.5. I think IE only supports this for their proprietary font format, which I didn’t used, and for some reason it didn’t work in Chrome 2 either (which I thought supported @font-face), but I didn’t investigate this further, at least not for now.<span id="more-28"></span></p>
<p>The way @font-face works is that whatever font attributes you specify for a @font-face rule, they don’t determine how the font looks but rather when it’s gonna get used. For example if you have the following two rules</p>
<pre class="brush:css">
@font-face {
	font-family: newfont;
	src: local(Arial);
	font-weight: 200;
}
@font-face {
	font-family: newfont;
	src: local(Calibri);
	font-weight: 300;
}
</pre>
<p>Then if you use the “newfont” font-family with weight 200 it’s going to use Arial, but if you use it with weight 300 it’s going to use Calibri. So we can take advantage of that, and since it uses @font-face we don’t even have to worry if the user’s computer has fonts or not.</p>
<p>For this test I used a Kaffeesatz, a nice looking opentype sans-serif font from <a href="http://yanone.de/typedesign/kaffeesatz/" target="_blank" rel="external nofollow">Yanone Schriftgestaltung</a>. The font comes with four weights, Thin, Light, Regular and Bold. I used the following styles to create 200 and 300 weights, in addition to normal and bold.</p>
<pre class="brush:css">
@font-face {
	font-family: Kaffeesatz;
	src: url(YanoneKaffeesatz-Thin.otf);
	font-weight: 200;
}
@font-face {
	font-family: Kaffeesatz;
	src: url(YanoneKaffeesatz-Light.otf);
	font-weight: 300;
}
@font-face {
	font-family: Kaffeesatz;
	src: url(YanoneKaffeesatz-Regular.otf);
	font-weight: normal;
}
@font-face {
	font-family: Kaffeesatz;
	src: url(YanoneKaffeesatz-Bold.otf);
	font-weight: bold;
}
h3, h4, h5, h6 {
	font-size:2em;
	margin:0;
	padding:0;
	font-family:Kaffeesatz;
	font-weight:normal;
}
h6 { font-weight:200; }
h5 { font-weight:300; }
h4 { font-weight:normal; }
h3 { font-weight:bold; }
</pre>
<p>As you can see I defined one font family — Kaffeesatz, and for each weight imported a different font file. After the @font-face rules are defined I can use the 200 and 300 font weights just as I would normal and bold, and the HTML below</p>
<pre class="brush:html">
&lt;h6&gt;The quick brown fox Jumps over the lazy Dog. 1234567890&lt;/h6&gt;
&lt;br&gt;
&lt;h5&gt;The quick brown fox Jumps over the lazy Dog. 1234567890&lt;/h5&gt;
&lt;br&gt;
&lt;h4&gt;The quick brown fox Jumps over the lazy Dog. 1234567890&lt;/h4&gt;
&lt;br&gt;
&lt;h3&gt;The quick brown fox Jumps over the lazy Dog. 1234567890&lt;/h3&gt;
</pre>
<p>produces the following text</p>
<p><img class="size-full wp-image-33 alignnone" title="fontweights" src="http://iliadraznin.com/wp/wp-content/uploads/2009/07/fontweights.jpg" alt="fontweights" width="669" height="258" /></p>
<p>Pretty neat if I may say so myself.</p>
<p>This is definitely more hassle than it should be, and of course requires you to find an open font that you can use with all the weights you need. However, as more browsers begin supporting @font-face, and as font support in browsers grows in general, typography will become more important on the web and hopefully many more fonts will start supporting multiple weights.</p>
]]></content:encoded>
			<wfw:commentRss>http://iliadraznin.com/2009/07/css3-font-face-multiple-weights/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>
