<?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>Onyx Design Weblog &#187; CSS</title>
	<atom:link href="http://www.onyx-design.net/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.onyx-design.net</link>
	<description>A weblog about webdesign, webdevelopment, css, php and other webrelated topics.</description>
	<lastBuildDate>Thu, 03 Jun 2010 15:34:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSS Diseases: Divitis &amp; Classitis</title>
		<link>http://www.onyx-design.net/featured/css-diseases-divitis-classitis/</link>
		<comments>http://www.onyx-design.net/featured/css-diseases-divitis-classitis/#comments</comments>
		<pubDate>Wed, 28 May 2008 13:00:54 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/css/css-diseases-divitis-classitis/</guid>
		<description><![CDATA[Are you one of the CSS coders that use &#60;div&#62;-tags for anything and add classes to every element? Learn why it&#8217;s wrong to do that and how you can cure your CSS disease.

What are Divitis and Classitis?
The terms Divitis and Classitis were first coined by Jeffrey Zeldman, in his book â€œDesigning With Web Standardsâ€ (thanks [...]]]></description>
			<content:encoded><![CDATA[<p>Are you one of the <acronym title="Cascading Style Sheets">CSS</acronym> coders that use &lt;div&gt;-tags for <em>anything</em> and add classes to every element? Learn why it&#8217;s wrong to do that and how you can cure your <acronym title="Cascading Style Sheets">CSS</acronym> disease.</p>
<p><span id="more-111"></span></p>
<h3>What are Divitis and Classitis?</h3>
<p>The terms Divitis and Classitis were first coined by Jeffrey Zeldman, in his book â€œDesigning With Web Standardsâ€ (thanks reader John). There is a pretty good explanation of what it is at <a href="http://www.tyssendesign.com.au/articles/faqs/what-is-divitis/" rel="nofollow" >Tyssen Design</a>:</p>
<blockquote><p>â€˜Divitisâ€™ is a term used to describe an error common amongst newcomers to building <acronym title="Cascading Style Sheets">CSS</acronym>-based sites whereby they use too many divs for everything. Divitis is related to â€˜classitisâ€™ and â€™span maniaâ€™, both terms used to describe the practise of combining spans with a class to style content when a more appropriate tag is available</p></blockquote>
<h4>Why is it wrong?</h4>
<p>Here are three reasons, why you shouldn&#8217;t use too much divs or spans:</p>
<ul>
<li><strong>It is not semantic<br />
</strong>Semantic coding, is using an element the way it&#8217;s meant to be used. For example: using tables for a design is wrong. Tables are meant for structuring tabular data only.</li>
<li><strong>It is bad for SEO<br />
</strong>Search engines pay attention to certain elements, like &lt;h#&gt;. If you not specify the content by using a neutral element like &lt;div&gt;, the search engines don&#8217;t know whether that content is important.</li>
<li><strong>It is superfluous<br />
</strong>Using unnecessary tags means more code, more code means a larger file and a larger file means more bandwith use and slower pageloads.</li>
</ul>
<h3>Examples</h3>
<h4>Header</h4>
<p>On a lot of site&#8217;s the following code is used for the header of the page:</p>
<p><code>&lt;div id="header&gt;<br />
&lt;img src="logo.jpg" alt="My site name" /&gt;<br />
&lt;/div&gt;</code><code><br />
</code></p>
<p>But it&#8217;s more semantic to use a &lt;h1&gt;-tag like this:</p>
<p><code>&lt;h1&gt;My site name&lt;/h1&gt;</code></p>
<p>And the following <acronym title="Cascading Style Sheets">CSS</acronym> code:</p>
<p><code>h1 {<br />
background:url(logo.jpg);<br />
text-indent:-9999px; /*(that will remove the text from the page)*/<br />
width:800px;<br />
height:150px;<br />
}</code></p>
<p>We just changed the &lt;div&gt; into a &lt;h1&gt;. This is good for SEO, for the search engine now sees that header image is the most important part of the page. And it&#8217;s more semantic to: the &lt;h1&gt; is meant for the most important header of the page, in this case the site name.</p>
<h4>Navigation</h4>
<p>I often see divs and spans used for navigation, while using a list is much easier. For example:</p>
<p>HTML:<br />
<code>&lt;div id="menu"&gt;<br />
&lt;span class="menu_item"&gt;Menu Item&lt;/span&gt;<br />
&lt;span class="menu_item"&gt;Menu Item&lt;/span&gt;<br />
&lt;span class="menu_item"&gt;Menu Item&lt;/span&gt;<br />
&lt;span class="menu_item"&gt;Menu Item&lt;/span&gt;<br />
&lt;/div&gt;</code></p>
<p>CSS:<br />
<code>#menu {<br />
/* your style*/<br />
}<br />
.menu_item {<br />
/* your style */<br />
}</code></p>
<p>First of all, there is no need to add a class to the span tags. You can easily target the &lt;span&gt; with <acronym title="Cascading Style Sheets">CSS</acronym> without a class. Like this:</p>
<p>HTML:<br />
<code>&lt;div id="menu"&gt;<br />
&lt;span&gt;Menu Item&lt;/span&gt;<br />
&lt;span&gt;Menu Item&lt;/span&gt;<br />
&lt;span&gt;Menu Item&lt;/span&gt;<br />
&lt;span&gt;Menu Item&lt;/span&gt;<br />
&lt;/div&gt;</code></p>
<p>CSS:<br />
<code>#menu {<br />
/* your style*/<br />
}<br />
#menu span {<br />
/* your style */<br />
}</code></p>
<p>But it would be more appropriate to use an unordered list (ul). You can see that you can very easily decrease the amount of code you use on your page.</p>
<p>HTML:<br />
<code>&lt;ul id="menu"&gt;<br />
&lt;li&gt;Menu Item&lt;/li&gt;<br />
&lt;li&gt;Menu Item&lt;/li&gt;<br />
&lt;li&gt;Menu Item&lt;/li&gt;<br />
&lt;li&gt;Menu Item&lt;/li&gt;<br />
&lt;/ul&gt;</code></p>
<p>CSS:<br />
<code>#menu {<br />
/* your style*/<br />
}<br />
#menu li {<br />
/* your style */<br />
}</code></p>
<h4>Other elements</h4>
<p>The previous examples are very basic, but even advanced <acronym title="Cascading Style Sheets">CSS</acronym> users don&#8217;t always use the right elements. Do you use <em>&lt;adress&gt;</em> for your contact data? Or <em>&lt;abbr&gt;</em> for you abbrevations?</p>
<h3>Conclusion</h3>
<p>Divitis, Classitis and over-using of spans are some of the most common <acronym title="Cascading Style Sheets">CSS</acronym> mistakes, but they are also easy to cure. Think a bit further that divs and spans and you&#8217;re almost there!</p>
<h3>Further Reading</h3>
<ul>
<li><a href="http://www.onyx-design.net/weblog2/css/css-adjacent-sibling-selector/"><acronym title="Cascading Style Sheets">CSS</acronym> Adjacent Sibling Selector</a>; this <acronym title="Cascading Style Sheets">CSS</acronym> selector is not well known but can be used to target some specific elements, and you don&#8217;t have to give them a class if you use this <acronym title="Cascading Style Sheets">CSS</acronym> selector.</li>
<li><a href="http://csscreator.com/?q=divitis" rel="nofollow" ><acronym title="Cascading Style Sheets">CSS</acronym> Creator Divitis: What It Is And How To Cure It</a></li>
<li><a href="http://www.tyssendesign.com.au/articles/faqs/what-is-divitis/" rel="nofollow" >What is Divitis? &#8211; Tyssen Design</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/featured/css-diseases-divitis-classitis/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>CSS coding for cross browser compatibility</title>
		<link>http://www.onyx-design.net/featured/css-coding-for-cross-browser-compatibility/</link>
		<comments>http://www.onyx-design.net/featured/css-coding-for-cross-browser-compatibility/#comments</comments>
		<pubDate>Mon, 12 May 2008 10:11:06 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/css/css-coding-for-cross-browser-compatibility/</guid>
		<description><![CDATA[Cross browser compatibility can be hard to achieve, but if you follow a few guidelines, you can make your CSS cross browser compatible a lot easier. Reset your CSS, use supported techniques and don&#8217;t forget to validate.
Reset your CSS
All browsers have default styles applied to certain HTML elements. For example, a h1 element is bold [...]]]></description>
			<content:encoded><![CDATA[<p>Cross browser compatibility can be hard to achieve, but if you follow a few guidelines, you can make your <acronym title="Cascading Style Sheets">CSS</acronym> cross browser compatible a lot easier. Reset your <acronym title="Cascading Style Sheets">CSS</acronym>, use supported techniques and don&#8217;t forget to validate.<span id="more-106"></span></p>
<h3>Reset your <acronym title="Cascading Style Sheets">CSS</acronym></h3>
<p>All browsers have default styles applied to certain <acronym title="HyperText Markup Language">HTML</acronym> elements. For example, a <em>h1</em> element is bold and larger by default, and has some margin too. The problem is that all browsers have different default styles so your <em>h1</em> won&#8217;t look the same in every browser. The font-size isn&#8217;t really</p>
<p>The solution is to <em>reset</em> the default styles of each browser and build it up again with your own styles. Because you&#8217;ve removed the standard browser styles, there won&#8217;t be any difference between the browsers. It&#8217;s like starting on a clean sheet.</p>
<p>There are a lot of <acronym title="Cascading Style Sheets">CSS</acronym> Resets available but <a href="http://meyerweb.com/eric/tools/css/reset/" rel="nofollow" >Eric Meyer&#8217;s <acronym title="Cascading Style Sheets">CSS</acronym> Reset</a> is the most popular, according to a <a href="http://css-tricks.com/poll-results-what-css-reset-do-you-use/" rel="nofollow" >poll on <acronym title="Cascading Style Sheets">CSS</acronym>-Tricks</a>. A round up of the most used <acronym title="Cascading Style Sheets">CSS</acronym> Resets can be found on <a href="http://perishablepress.com/press/2007/10/23/a-killer-collection-of-global-css-reset-styles/" rel="nofollow" >here</a>.</p>
<p><strong>The disadvantage of a <acronym title="Cascading Style Sheets">CSS</acronym> reset</strong> is that you have to write a lot more code. Every element you reset, has to be build up again. That&#8217;s the reason why a lot of designers use a custom <acronym title="Cascading Style Sheets">CSS</acronym> Reset (13% according to the <acronym title="Cascading Style Sheets">CSS</acronym>-Tricks poll) or <a href="http://snook.ca/archives/html_and_css/no_css_reset/" rel="nofollow" >no <acronym title="Cascading Style Sheets">CSS</acronym> reset at all</a>. Veerle Pieters showed <a href="http://veerle.duoh.com/blog/comments/starting_with_css_and_bug_fixing_tips/#c_18605" rel="nofollow" >her limited <acronym title="Cascading Style Sheets">CSS</acronym> Reset</a> in a reply to a question of <a href="http://veerle.duoh.com/blog/comments/starting_with_css_and_bug_fixing_tips/#c_18598" rel="nofollow" >mine</a>.</p>
<p>A <acronym title="Cascading Style Sheets">CSS</acronym> Reset is important for cross browser compatibility, but you have to decide for yourself how far you must go when resetting your <acronym title="Cascading Style Sheets">CSS</acronym> file.</p>
<h3>Using supported techniques</h3>
<p><acronym title="Cascading Style Sheets">CSS</acronym> offers a lot of techniques, but not all of them are good supported by every browser. For example the <em>:before</em> and <em>:after</em> pseudo selectors, which don&#8217;t work in any version of Internet Explorer, shouldn&#8217;t be used.</p>
<p>Nor should the attribute selectors (like <em>a[href $='.pdf']</em>), for their bad browser support. If you want to use the attribute selectors, use <a href="http://www.webdesignerwall.com/demo/jquery/link-types.html" rel="nofollow" >jQuery</a> instead of <a href="http://www.askthecssguy.com/2006/12/showing_hyperlink_cues_with_cs_1.html" rel="nofollow" ><acronym title="Cascading Style Sheets">CSS</acronym></a>. jQuery is a good way to imitate <acronym title="Cascading Style Sheets">CSS</acronym> selectors. It can be downloaded <a href="http://docs.jquery.com/Downloading_jQuery" rel="nofollow" >here</a>.</p>
<p>A good overview of <acronym title="Cascading Style Sheets">CSS</acronym> Selectors and their browser support can be found <a href="http://www.westciv.com/style_master/academy/browser_support/selectors.html" rel="nofollow" >here</a>.</p>
<h3>Validate</h3>
<p>I think this one is obvious: Take the time to validate your <acronym title="Cascading Style Sheets">CSS</acronym> styles. Cross browser compatibility is way easier with good and valid <acronym title="Cascading Style Sheets">CSS</acronym>. You can validate your <acronym title="Cascading Style Sheets">CSS</acronym> file using the <a href="http://jigsaw.w3.org/css-validator/" rel="nofollow" >W3 <acronym title="Cascading Style Sheets">CSS</acronym> Validator</a>.</p>
<h3>Summary</h3>
<p>Follow these three guidelines and your <acronym title="Cascading Style Sheets">CSS</acronym> file will have a lot more browser support:</p>
<ul>
<li>Reset your <acronym title="Cascading Style Sheets">CSS</acronym>,</li>
<li>Use only supported techniques and&#8230;</li>
<li>Validate!</li>
</ul>
<p>What are the techniques that you use to assure cross browser compatibility? Please leave a comment and share your thoughts.</p>
<h3>Further Reading</h3>
<ul>
<li><a href="http://www.onyx-design.net/weblog2/other/cross-browser-compatible-in-5-steps/">Make your site cross browser compatible in 5 steps</a></li>
<li><a href="http://www.onyx-design.net/weblog2/featured/css-hacks-inside-css/"><acronym title="Cascading Style Sheets">CSS</acronym> hacks inside <acronym title="Cascading Style Sheets">CSS</acronym></a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/featured/css-coding-for-cross-browser-compatibility/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>12 Articles and Tools for CSS structuring and optimising</title>
		<link>http://www.onyx-design.net/featured/12-articles-and-tools-for-css-structuring-and-optimising/</link>
		<comments>http://www.onyx-design.net/featured/12-articles-and-tools-for-css-structuring-and-optimising/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 08:01:56 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/css/12-articles-and-tools-for-css-structuring-and-optimising/</guid>
		<description><![CDATA[Optimising andÂ structuring your CSS file is important, especially when you have a large stylesheet. Optimising and structuring your site makes your stylesheet more readable, which makes it easier to update. It can also make your CSS file smaller in size, so your page will load quicker. A list of great tools and articles to optimise [...]]]></description>
			<content:encoded><![CDATA[<p>Optimising andÂ structuring your <acronym title="Cascading Style Sheets">CSS</acronym> file is important, especially when you have a large stylesheet. Optimising and structuring your site makes your stylesheet more readable, which makes it easier to update. It can also make your <acronym title="Cascading Style Sheets">CSS</acronym> file smaller in size, so your page will load quicker. A list of great tools and articles to optimise and structure your <acronym title="Cascading Style Sheets">CSS</acronym>.<span id="more-92"></span></p>
<h3>Articles</h3>
<p><strong><a href="http://friendlybit.com/css/how-to-structure-large-css-files/" rel="nofollow" >How to structure large css files</a></strong><br />
An extensive article whith a lot of tips and tricks to structure large <acronym title="Cascading Style Sheets">CSS</acronym> files.</p>
<p><strong><a href="http://woork.blogspot.com/2008/03/write-well-structured-css-file-without.html" rel="nofollow" >Write a well structured <acronym title="Cascading Style Sheets">CSS</acronym> file without becoming crazy</a></strong><br />
A great article on Woork explaining how to be simple, methodic and &#8220;elegant-code&#8221; oriented.</p>
<p><a href="http://woork.blogspot.com/2008/01/optimize-your-css-files-to-improve-code.html" rel="nofollow" ><strong>Optimize your <acronym title="Cascading Style Sheets">CSS</acronym> files to improve code readability</strong></a><br />
Another article on Woork, very clear with much example code.</p>
<p><a href="http://woork.blogspot.com/2008/04/top-down-approach-to-simplify-your-css.html" rel="nofollow" ><strong>Top-Down approach to simplify your <acronym title="Cascading Style Sheets">CSS</acronym> code</strong></a><br />
What is the correct approach to design a <acronym title="Cascading Style Sheets">CSS</acronym> file? Well, it&#8217;s the Top-Down approach. It&#8217;s about minimizing the number of <acronym title="Cascading Style Sheets">CSS</acronym> elements and using standard <acronym title="HyperText Markup Language">HTML</acronym> tags (like h1, p, ul, &#8230;)</p>
<p><a href="http://css-tricks.com/videos/css-tricks-video-8.php"><strong><acronym title="Cascading Style Sheets">CSS</acronym> Formatting Screencast<br />
</strong></a>A screencast on <acronym title="Cascading Style Sheets">CSS</acronym> Tricks, showing how to format your <acronym title="Cascading Style Sheets">CSS</acronym> very clearly. You should watch this one.</p>
<p><a href="http://www.456bereastreet.com/archive/200502/efficient_css_with_shorthand_properties/"><strong>Efficient <acronym title="Cascading Style Sheets">CSS</acronym> with shorthand properties<br />
</strong></a>This is a really great article on 456 Berea Street explaining <em>all</em> shorthand properties. A guide for all webdesigners who want to code efficiently.</p>
<p><a href="http://paulstamatiou.com/2007/03/18/how-to-optimize-your-css-even-more" rel="nofollow" ><strong>Optimize Your <acronym title="Cascading Style Sheets">CSS</acronym> even more</strong></a><br />
Paul Stamatiou wrote this article about optimising your <acronym title="Cascading Style Sheets">CSS</acronym> file by compressing it. He uses <acronym title="Pre-Hypertext Processing">PHP</acronym> to compress the <acronym title="Cascading Style Sheets">CSS</acronym> file into a .gz format.</p>
<h3>Tools</h3>
<p><a href="http://www.bloggingpro.com/archives/2006/08/17/css-optimization/" rel="nofollow" ><strong>Review of <acronym title="Cascading Style Sheets">CSS</acronym> optimization Tools</strong></a><br />
This review on BloggingPro shows clearly the advantages and disadvantages of the most common <acronym title="Cascading Style Sheets">CSS</acronym> optimization tools. You should read this before using one. This article tells you that &#8220;<a href="http://iceyboard.no-ip.org/projects/css_compressor" rel="nofollow" >Icey&#8217;s <acronym title="Cascading Style Sheets">CSS</acronym> compressor</a>&#8221; is the best one.</p>
<p>The most used <acronym title="Cascading Style Sheets">CSS</acronym> optimization tools are:</p>
<ul>
<li><a href="http://www.cleancss.com/" rel="nofollow" >Clean <acronym title="Cascading Style Sheets">CSS</acronym></a></li>
<li><a href="http://iceyboard.no-ip.org/projects/css_compressor" rel="nofollow" >Robson <acronym title="Cascading Style Sheets">CSS</acronym> compressor</a></li>
<li><a href="http://www.cssoptimiser.com/" rel="nofollow" ><acronym title="Cascading Style Sheets">CSS</acronym> Optimiser.com</a></li>
<li><a href="http://flumpcakes.co.uk/css/optimiser/" rel="nofollow" >Flumpcakes <acronym title="Cascading Style Sheets">CSS</acronym> Optimiser</a></li>
</ul>
<h3>Conclusion</h3>
<p>With this articles, you can easily optimise and organize your <acronym title="Cascading Style Sheets">CSS</acronym> file. If you don&#8217;t have time to do it your self, you can use one of the great <acronym title="Cascading Style Sheets">CSS</acronym> optimization tools. Have I omitted an article or a tool, please tell me.</p>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/featured/12-articles-and-tools-for-css-structuring-and-optimising/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Nice Drop caps with CSS</title>
		<link>http://www.onyx-design.net/featured/nice-drop-caps-with-css/</link>
		<comments>http://www.onyx-design.net/featured/nice-drop-caps-with-css/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 18:50:46 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/css/nice-drop-caps-with-css/</guid>
		<description><![CDATA[There are a lot of websites using a extra &#60;span&#62;-tag for the drop cap. But using the :first-letter pseudo-element, you can easily create nice drop caps with CSS. :first-letter will &#8211; how surprising &#8211; target the first letter of an element. This pseudo element is included in CSS 1, so the browser support is very [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of websites using a extra <em>&lt;span&gt;-tag</em> for the drop cap. But using the <em>:first-letter</em> pseudo-element, you can easily create nice drop caps with <acronym title="Cascading Style Sheets">CSS</acronym>. <em>:first-letter</em> will &#8211; how surprising &#8211; target the first letter of an element. This pseudo element is included in <acronym title="Cascading Style Sheets">CSS</acronym> 1, so the browser support is very good. It&#8217;s supported by <acronym title="Internet Explorer 5">IE5</acronym>+, Let&#8217;s design some nice drop caps with <acronym title="Cascading Style Sheets">CSS</acronym>.<span id="more-90"></span></p>
<h3>Designing</h3>
<p>Unfortunately you can only apply a limited amount of properties to a first letter. According to <a href="http://www.w3schools.com/CSS/pr_pseudo_first-letter.asp" rel="nofollow" >w3schools</a> only font, color, background, margin, padding, border, float and some other properties can be applied. Still you can make a nice drop cap with <acronym title="Cascading Style Sheets">CSS</acronym>.</p>
<p>I used this <acronym title="Cascading Style Sheets">CSS</acronym> code:</p>
<p><code>p:first-letter {<br />
display:block;<br />
float:left;<br />
border:1px solid black;<br />
padding:5px;<br />
margin:4px 5px;<br />
background:url(firstletter1.png);<br />
font-size:73px;<br />
}</code></p>
<p><a href="http://commons.wikimedia.org/wiki/Image:Triquetra-Cross-alternate.png" rel="nofollow" >This</a> image of Wikipedia Commons was used for the background image. Click here to <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/03/cssfirstletter.php"title="Example Page of this article" ><strong>view the example page</strong></a>.</p>
<p>I have some issues with this in Opera: the background doesn&#8217;t have the same height as the text. I don&#8217;t really know how to fix this, because there is no way to specify the height of the first letter in <acronym title="Cascading Style Sheets">CSS</acronym>. It works good in all other major browsers.</p>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/featured/nice-drop-caps-with-css/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>How to make RSS icons in every colour with just one image</title>
		<link>http://www.onyx-design.net/featured/how-to-make-rss-icons-in-every-colour-with-just-one-image/</link>
		<comments>http://www.onyx-design.net/featured/how-to-make-rss-icons-in-every-colour-with-just-one-image/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 10:25:28 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/css/how-to-make-rss-icons-in-every-colour-with-just-one-image/</guid>
		<description><![CDATA[In this article, I will explain to you how you can make a RSS in every colour using just one image. The trick is a div with a partially transparent icon and the background color you like.
The Idea
The idea is a &#60;div&#62; with a specified width and height (the same as the icon). This icon [...]]]></description>
			<content:encoded><![CDATA[<p>In this article, I will explain to you how you can make a <acronym title="Really Simple Syndication">RSS</acronym> in every colour using just one image. The trick is a div with a partially transparent icon and the background color you like.<span id="more-89"></span></p>
<h3>The Idea</h3>
<p>The idea is a &lt;div&gt; with a specified width and height (the same as the icon). This <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/03/rss32.png">icon</a> (you might not see something, because it&#8217;s white) is set as the background image of the &lt;div&gt;. You&#8217;ll also have to set a background color, that will fill the <acronym title="Really Simple Syndication">RSS</acronym> icon. If you don&#8217;t really get it, see this <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/03/explain.jpg">explaining illustration</a> I made.</p>
<h3>The Code</h3>
<p>For this icon you&#8217;ll need the <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/03/rss32.png">image</a> and some <acronym title="Cascading Style Sheets">CSS</acronym> and <acronym title="HyperText Markup Language">HTML</acronym> code:</p>
<p>CSS:<br />
<code>.rssicon32 {<br />
width:32px;<br />
height:32px;<br />
background-image:url(rss32.png);<br />
background-color:red;<br />
}</code></p>
<p>HTML:<br />
<code>&lt;div class="rssicon32"&gt;&lt;/div&gt;</code></p>
<p>I&#8217;ve have made an extensive <strong><a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/03/icon.php">EXAMPLE PAGE</a></strong>, where you can see some of the icons. The image i linked to previously is used on this in three different sizes (16&#215;16, 32&#215;32 and 64&#215;64).</p>
<h3>Improving the technique</h3>
<p>This technique has a lot of benefits, like you can use the same image for a hover effect, only changing the background color, which makes it quick and light weight. Another benefit is that you don&#8217;t need to change the image if you want a new colour. But there are also some disadvantages: this image works only on white and you can say that this technique is less SEO friendly than a regular image.<br />
<!-- give me space --><span style="display: none">a</span><br />
<strong>Making it SEO friendly with <acronym title="Cascading Style Sheets">CSS</acronym> image replacement</strong><br />
There is however a simple way to make this technique more SEO friendly. I will be using <acronym title="Cascading Style Sheets">CSS</acronym> image replacement. <acronym title="Cascading Style Sheets">CSS</acronym> image replacement is a technique often used to display images instead of text in a SEO friendly way. If you, for example use a header image instead of a &lt;h1&gt;-tag, that&#8217;s not very good for SEO, but if you replace the &lt;h1&gt;-tag with an image, you&#8217;ll have a SEO friendly and nice header. There are several techniques for <acronym title="Cascading Style Sheets">CSS</acronym> images replacement and a good overview can be found on <a href="http://css-tricks.com/nine-techniques-for-css-image-replacement/" rel="nofollow" ><acronym title="Cascading Style Sheets">CSS</acronym> Tricks</a>. You can choose the technique which you think is best, but in this case, I&#8217;ll go for the negative <em>text-indent.</em> I have added some text inside the div, which is hidden, because of the negative <em>text-indent</em>.</p>
<p>HTML:<br />
<code>&lt;div class="rssicon32"&gt;Subsribe my <acronym title="Really Simple Syndication">RSS</acronym> feed&lt;/div&gt;</code><br />
<strong>Making it compatible for every background<br />
</strong>There is a way to make this <acronym title="Really Simple Syndication">RSS</acronym> icon compatible with every background, but you&#8217;ll loose the rounded corners that way. So there are two options: change the colour of the rounded corners manually with photo editing software or drop the rounded corners. Both ways are displayed on the <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/03/icon.php"title="RSS icon example page" >EXAMPLE PAGE</a>.</p>
<h3>Conclusion</h3>
<p>I really like this technique and the opportunities of it. You make nice visual effects and still it&#8217;s very light weight and it will save you bandwidth. If you have something to say about this article, please share your thoughts and place a comment.</p>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/featured/how-to-make-rss-icons-in-every-colour-with-just-one-image/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>CSS Adjacent-Sibling Selector</title>
		<link>http://www.onyx-design.net/css/css-adjacent-sibling-selector/</link>
		<comments>http://www.onyx-design.net/css/css-adjacent-sibling-selector/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 12:48:46 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/uncategorized/css-adjacent-sibling-selector/</guid>
		<description><![CDATA[Most CSS selectors are well known, but there are some interesting selectors that are not common used, like the adjacent-sibling selector. An adjacent sibling selector will select the sibling immediately following an element, with the same parent. In this example, I will show you how to use the adjacent-sibling selector to style this list.
What exactly [...]]]></description>
			<content:encoded><![CDATA[<p>Most <acronym title="Cascading Style Sheets">CSS</acronym> selectors are well known, but there are some interesting selectors that are not common used, like the adjacent-sibling selector. An adjacent sibling selector will select the sibling immediately following an element, with the same parent. In this example, I will show you how to use the adjacent-sibling selector to style <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/list1.html">this</a> list.<span id="more-57"></span></p>
<h3>What exactly is an adjacent-sibling selector and what is the syntaxis?</h3>
<p>An adjacent-sibling selector targets an element directly after another element with the same parent. For example you can target every<em> &lt;h3&gt;</em> that is directly after a <em>&lt;h2&gt;</em>. A really clear explanation of this selector can be found on <a href="http://css.maxdesign.com.au/selectutorial/selectors_adjacent.htm" rel="nofollow" >Selectutorial</a>. The syntaxis of this selector is the +. For example:<br />
<code>h2 + h3 {<br />
color:red;<br />
}</code></p>
<p>As you can see <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/list0.html">here</a> the<em> &lt;h3&gt;</em> which comes directly after the <em>&lt;h2&gt;</em> becomes red.</p>
<h3>How can you style <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/list1.html">this</a> list with the adjacent-sibling selector?</h3>
<p>With the adjacent-sibling selector, you can target any of the <em>&lt;li&gt;</em>-element without giving them any classes or id&#8217;s. That saves time and also bytes. So it&#8217;s convenient and cheaper. Let&#8217;s put it into practice. The plan is to give the first three countries another color and a medal. So USA get&#8217;s a gold medal, China a silver one and the bronze one is for Russia. I will use these images:<br />
<img src="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/gold.gif" alt="nogeen404.png" /><img src="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/silver.gif" alt="nogeen404.png" height="13" width="10" /><img src="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/brons.gif" height="13" width="10" />.</p>
<p>But first, let take a look at the <acronym title="Cascading Style Sheets">CSS</acronym> that will target the different countries:<br />
<code>li {<br />
/* 1st : U.S.A. */<br />
}</code><br />
<code><br />
li + li {<br />
/* 2nd : China */<br />
}</code><br />
<code><br />
li + li + li {<br />
/* 3rd : Russia */<br />
}</code><br />
<code><br />
li+ li + li + li {<br />
/* every other li element*/<br />
}</code></p>
<p>You may ask yourself why the fourth selector is there, as we don&#8217;t want to style the fourth element. But pay attention that <em>li+li+li</em> targets every element that has <em>at least 2</em> other li elements of the same parent before itself, you must set the color and other elements back to default or all other li elements will be styled like the third one. Now you have the selectors, you can be creative in order to style the list. <strong><a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/list3.html">This is my outcome</a>.</strong></p>
<p>The <acronym title="Cascading Style Sheets">CSS</acronym> I used to make <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/list3.html">this list</a>:</p>
<p><code>li {<br />
background:url(gold.gif) no-repeat;<br />
background-position:70px 50%;<br />
color:gold;<br />
font-size:1.1em;<br />
font-weight:bold;<br />
}</code></p>
<p><code>li + li {<br />
background:url(silver.gif) right no-repeat;<br />
color:silver;<br />
background-position:70px 50%;<br />
}</code></p>
<p><code>li + li + li {<br />
background:url(brons.gif) right no-repeat;<br />
color:#8B5A2B;<br />
background-position:70px 50%;<br />
}</code></p>
<p><code>li+ li + li + li {<br />
font-weight:normal;<br />
color:white;<br />
background:none;<br />
padding:0;<br />
font-size:1.0em;<br />
}</code></p>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/css/css-adjacent-sibling-selector/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>CSS Positioning</title>
		<link>http://www.onyx-design.net/css/css-positioning/</link>
		<comments>http://www.onyx-design.net/css/css-positioning/#comments</comments>
		<pubDate>Sun, 03 Feb 2008 13:06:30 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/css/css-positioning/</guid>
		<description><![CDATA[There are many ways to position your elements in CSS. Relative positioning, absolute positioning or a combination of both. I&#8217;ll explain those ways with some clear examples.
position:static
Our example file is a simple page with one div, which has two nested divs inside it. Click here to view. There is no position specified in the CSS [...]]]></description>
			<content:encoded><![CDATA[<p>There are many ways to position your elements in <acronym title="Cascading Style Sheets">CSS</acronym>. Relative positioning, absolute positioning or a combination of both. I&#8217;ll explain those ways with some clear examples.<span id="more-36"></span></p>
<h3>position:static</h3>
<p>Our example file is a simple page with one div, which has two nested divs inside it. Click <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/pos1.html">here</a> to view. There is no position specified in the <acronym title="Cascading Style Sheets">CSS</acronym> so the default value is applied: <em>position:static;</em>. There is no need to specify that in the <acronym title="Cascading Style Sheets">CSS</acronym>-file unless you need to override a positioning that had been previously set.</p>
<h3>position:relative</h3>
<p>You can use relative positioning to position an element relative to where it would normally be. For example we move <em>div one-one </em>40 pixels to the left and also 40 pixels to the top. The <acronym title="Cascading Style Sheets">CSS</acronym> code:<br />
<code>.one-one {<br />
position:relative;<br />
left:40px;<br />
top:-40px;<br />
}</code><br />
You can also use <em>bottom:40px;</em> instead of <em>top:-40px;</em>, but most webdesigners always specify left and top. Let&#8217;s take a look at the <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/pos2.html">result</a>. You see that the <em>div one-one</em> has moved 40 pixels to the left and 40 pixels to the top. The div is moved, but this hasn&#8217;t affected the flow of the page. The space where the div was before we moved it, is empty.</p>
<h3>position:absolute</h3>
<p>With absolute positioning, the div is removed from the page flow and moved exactly to the specified place. Let&#8217;s move <em>div one-two</em> to the upper-right corner. You&#8217;ll need this <acronym title="Cascading Style Sheets">CSS</acronym> code:<br />
<code>.one-two {<br />
position:absolute;<br />
right:0;<br />
top:0;<br />
}</code><br />
There is no need to say 0px, because 0px is exactly the same as 0cm or 0%.<br />
This is what the <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/pos3.html">result</a> looks like. The space which was used by <em>div one-two</em> is now empty.</p>
<h3>relative + absolute</h3>
<p>This is one of my favourite tricks. By using relative <em>and</em> absolute positioning, you can place <em>div one-one</em> in a corner of<em> div one</em>. The code:<br />
<code>.one {<br />
position:relative;<br />
}<br />
.one-one {<br />
position:absolute;<br />
right:0;<br />
top:0;<br />
}</code><br />
By setting <em>div one</em> to relative, <em>div one-one</em> is placed in the upper-right corner of <em>div one.</em> Click <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/pos4.html">here</a> to view.</p>
<h3>float:</h3>
<p>float: is also a very convenient <acronym title="Cascading Style Sheets">CSS</acronym> attribute position elements. With float:, you can float an element against the left or right border of it&#8217;s parent element. In this example, we&#8217;ll let <em>div 1-1</em> and <em>div 1-2</em> float inside <em>div 1.</em> The <acronym title="Cascading Style Sheets">CSS</acronym> code:<br />
<code><br />
.one {<br />
width:600px;<br />
}</code><br />
<code><br />
.one-one {<br />
float:left;<br />
width:200px;<br />
}</code><br />
<code><br />
.one-two {<br />
float:right;<br />
width:200px;<br />
}</code></p>
<p>See the outcome <a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/02/pos5.html">here.</a> Thanks to David Karasek for remembering me of the float: attribute. If you want some more detailed information about positioning, see <a href="http://www.barelyfitz.com/screencast/html-training/css/positioning/" rel="nofollow" >this 10 step tutorial</a>.</p>
<p>Please digg this article if you liked it or share your thoughts in a comment.</p>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/css/css-positioning/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CSS Hacks inside CSS</title>
		<link>http://www.onyx-design.net/css/css-hacks-inside-css/</link>
		<comments>http://www.onyx-design.net/css/css-hacks-inside-css/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 19:24:48 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/featured/css-hacks-inside-css/</guid>
		<description><![CDATA[Some browsers don&#8217;t support CSS as well as others. Some designs require CSS-hacks to assure browser compatibility. I think that the most used CSS hack must be the use of Conditional Comments, but the major disadvantage of Conditional Comments is that they require to change the HTML file. Sometimes it&#8217;s not possible or not convenient [...]]]></description>
			<content:encoded><![CDATA[<p>Some browsers don&#8217;t support <acronym title="Cascading Style Sheets">CSS</acronym> as well as others. Some designs require <acronym title="Cascading Style Sheets">CSS</acronym>-hacks to assure browser compatibility. I think that the most used <acronym title="Cascading Style Sheets">CSS</acronym> hack must be the use of <a href="http://www.quirksmode.org/css/condcom.html" rel="nofollow"  title="Conditional Comments">Conditional Comments</a>, but the major disadvantage of Conditional Comments is that they require to change the <acronym title="HyperText Markup Language">HTML</acronym> file. Sometimes it&#8217;s not possible or not convenient to change the <acronym title="HyperText Markup Language">HTML</acronym>, for example when you already have a site with hundreds of pages and you don&#8217;t want to add the conditional comments to make use of the new design. That&#8217;s why I&#8217;m writing an article about <acronym title="Cascading Style Sheets">CSS</acronym> hacks that you can use inside the <acronym title="Cascading Style Sheets">CSS</acronym> file.</p>
<p>These hacks all use valid <acronym title="Cascading Style Sheets">CSS</acronym>.<span id="more-21"></span><br />
<span id="more-4"></span></p>
<h3>Hide From Internet Explorer 6</h3>
<p>Internet Explorer 6 is causing much bugs. It often does not handle <acronym title="Cascading Style Sheets">CSS</acronym> correctly and that can cause some trouble. You can however easily hide some (adjusting) rules from Internet Explorer 6. This is how:</p>
<p><code> #text {<br />
color:green; /* The color is set to green */<br />
}<br />
html&gt;body #text {<br />
color:red; /* The color is adjusted to red, but <acronym title="Internet Explorer 6">IE6</acronym> doesn't see this rule */<br />
}</code></p>
<p>The text will be red in all browsers, except Internet Explorer 6. For example you can use this hack to adjust the margin or padding if that&#8217;s wrong in Internet Explorer 6.</p>
<h3>Hide From Internet Explorer 7</h3>
<p>This is the same code as before, but we&#8217;ve added a comment between the selectors. IE7 doesn&#8217;t see this so the rule will be ignored.</p>
<p><code> #text {<br />
color:green; /* Color is set to green */<br />
}<br />
html&gt;/**/body #text {<br />
color:red; /* Color is set to red, but NO version of Internet Explorer sees this */<br />
}</code></p>
<h3>Result</h3>
<p>I added the 2 examples into one <acronym title="HyperText Markup Language">HTML</acronym> file.<br />
<a href="http://www.onyx-design.net/weblog2/wp-content/uploads/2008/01/red-green.html" title="css hacks in css">See the result</a> (Look at the difference between Internet Explorers and other browsers)</p>
<p>And this is the complete source code:</p>
<p><code>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;&lt;/title&gt;<br />
&lt;style&gt;<br />
#text1 {<br />
color:green; /* The color is set to green */<br />
}<br />
html&gt;body #text1 {<br />
color:red; /* The color is adjusted to red, but <acronym title="Internet Explorer 6">IE6</acronym> doesn't see this rule */<br />
}<br />
#text2 {<br />
color:green; /* Color is set to green */<br />
}<br />
html&gt;/**/body #text2 {<br />
color:red; /* Color is set to red, but NO version of Internet Explorer sees this */<br />
}<br />
&lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;p id="text1"&gt;If this text is green, you are using Internet Explorer 6 (or older)&lt;/p&gt;<br />
&lt;p id="text2"&gt;If this text is green, you are using Internet Explorer 7 (or older)&lt;/p&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</code></p>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/css/css-hacks-inside-css/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
