<?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; design</title>
	<atom:link href="http://iliadraznin.com/tag/design/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>Blog redesign is done</title>
		<link>http://iliadraznin.com/2010/07/blog-redesign-done/</link>
		<comments>http://iliadraznin.com/2010/07/blog-redesign-done/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 00:45:44 +0000</pubDate>
		<dc:creator>Ilia</dc:creator>
				<category><![CDATA[else()]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[else]]></category>

		<guid isPermaLink="false">http://iliadraznin.com/?p=267</guid>
		<description><![CDATA[So the new look for the IliaDraznin.com is up. There were some teething pains (categories disappeared there for half a day or so), but it all seems to be working out now. Biggest addition, other than the new design, is the Syntax Highlighter script, to make all those code chunks look nice. There are still [...]]]></description>
			<content:encoded><![CDATA[<p>So the new look for the IliaDraznin.com is up. There were some teething pains (categories disappeared there for half a day or so), but it all seems to be working out now. Biggest addition, other than the new design, is the Syntax Highlighter script, to make all those code chunks look nice.</p>
<p>There are still a few features missing but I’ll be adding those in the upcoming weeks. Anyway, it’s back to our regular scheduled programming now.</p>
]]></content:encoded>
			<wfw:commentRss>http://iliadraznin.com/2010/07/blog-redesign-done/feed/</wfw:commentRss>
		<slash:comments>0</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>
