<?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>Scarf*oo &#187; web development</title>
	<atom:link href="http://scarfoo.com/archives/category/web-development/feed" rel="self" type="application/rss+xml" />
	<link>http://scarfoo.com</link>
	<description>Comfy Web Development With Standards in Mind</description>
	<lastBuildDate>Wed, 19 May 2010 18:59:20 +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>Forgotten CSS selectors &#124; 456 Berea Street</title>
		<link>http://scarfoo.com/archives/266</link>
		<comments>http://scarfoo.com/archives/266#comments</comments>
		<pubDate>Fri, 05 Feb 2010 07:24:30 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=266</guid>
		<description><![CDATA[Now that IE6 is practically dead and gone, we can embrace the power that comes with CSS 2.1 selectors. Hurray! Forgotten CSS selectors &#124; 456 Berea Street. Related Posts:Hiding with CSS: Problems and solutions &#124; 456 Berea StreetNVDA – a free, open source screen reader &#124; 456 Berea StreetCSS Differences in Internet Explorer 6, 7 [...]]]></description>
			<content:encoded><![CDATA[<p>Now that IE6 is practically dead and gone, we can embrace the power that comes with CSS 2.1 selectors. Hurray! <a href='http://www.456bereastreet.com/archive/201002/forgotten_css_selectors/'>Forgotten CSS selectors | 456 Berea Street</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/231" rel="bookmark" class="crp_title">Hiding with CSS: Problems and solutions | 456 Berea Street</a></li><li><a href="http://scarfoo.com/archives/179" rel="bookmark" class="crp_title">NVDA – a free, open source screen reader | 456 Berea Street</a></li><li><a href="http://scarfoo.com/archives/259" rel="bookmark" class="crp_title">CSS Differences in Internet Explorer 6, 7 and 8 «  Smashing Magazine</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/266/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Log in or sign up? &#8211; Leah Culvers Blog</title>
		<link>http://scarfoo.com/archives/261</link>
		<comments>http://scarfoo.com/archives/261#comments</comments>
		<pubDate>Mon, 16 Nov 2009 07:14:17 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=261</guid>
		<description><![CDATA[How about putting both log-in and register forms into one? A nice informative read. Log in or sign up? &#8211; Leah Culvers Blog. Related Posts:New Scarf*oo Blog ThemeCSS Gradients Support in WebKitFinally Real And Legal Fonts With Typekit?Powered by Contextual Related Posts]]></description>
			<content:encoded><![CDATA[<p>How about putting both log-in and register forms into one? A nice informative read.</p>
<p><a href='http://blog.leahculver.com/2009/11/log-in-or-sign-up.html'>Log in or sign up? &#8211; Leah Culvers Blog</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/19" rel="bookmark" class="crp_title">New Scarf*oo Blog Theme</a></li><li><a href="http://scarfoo.com/archives/50" rel="bookmark" class="crp_title">CSS Gradients Support in WebKit</a></li><li><a href="http://scarfoo.com/archives/239" rel="bookmark" class="crp_title">Finally Real And Legal Fonts With Typekit?</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/261/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Differences in Internet Explorer 6, 7 and 8 «  Smashing Magazine</title>
		<link>http://scarfoo.com/archives/259</link>
		<comments>http://scarfoo.com/archives/259#comments</comments>
		<pubDate>Wed, 14 Oct 2009 16:32:53 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=259</guid>
		<description><![CDATA[If you haven&#8217;t decided to drop IE6 support, this might be the right time to do it. The article CSS Differences in Internet Explorer 6, 7 and 8 over at Smashing Magazine is a great reference to CSS differences between various IE versions when handling advanced CSS rules. Looks like versions 7 and up already [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t decided to drop IE6 support, this might be the right time to do it. The article <a href='http://www.smashingmagazine.com/2009/10/14/css-differences-in-internet-explorer-6-7-and-8/'>CSS Differences in Internet Explorer 6, 7 and 8</a> over at Smashing Magazine is a great reference to CSS differences between various IE versions when handling advanced CSS rules. Looks like versions 7 and up already support the vast majority of rules you throw at them, so if you want to take advantage of advanced CSS selectors to ease styles development, go on, I don&#8217;t believe many will be hurt in the process.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/235" rel="bookmark" class="crp_title">Universal Internet Explorer 6 CSS</a></li><li><a href="http://scarfoo.com/archives/50" rel="bookmark" class="crp_title">CSS Gradients Support in WebKit</a></li><li><a href="http://scarfoo.com/archives/30" rel="bookmark" class="crp_title">Browser Version Targeting Anyone?</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/259/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I Structure My CSS Files</title>
		<link>http://scarfoo.com/archives/152</link>
		<comments>http://scarfoo.com/archives/152#comments</comments>
		<pubDate>Mon, 05 Oct 2009 16:09:43 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[back to the basics]]></category>
		<category><![CDATA[file organization]]></category>
		<category><![CDATA[structure]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=152</guid>
		<description><![CDATA[Let&#8217;s face it, navigating and maintaining large CSS files is no fun. As long as the site is small or if you happen to be in the early stages of development, the CSS file looks manageable, but once you hit the 2k+ line mark, finding what you are looking for can take a while. Not [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s face it, navigating and maintaining large CSS files is no fun. As long as the site is small or if you happen to be in the early stages of development, the CSS file looks manageable, but once you hit the 2k+ line mark, finding what you are looking for can take a while. Not to mention how your team is going to pollute your style.css if the file structure is overly complicated.<br />
<span id="more-152"></span><br />
With some proper CSS file organization, you can wave these problems goodbye. What I am suggesting here is an organization style that has worked for me and my team so far. Let&#8217;s dig into it. </p>
<h3>Structure</h3>
<p><strong>1. Reset</strong><br />
I could as well link one of the many reset.css style sheets, but to save on server requests, I&#8217;ve decided to put the reset styles on the top of my main CSS file.</p>
<p><strong>2. Base</strong><br />
The html, body and defaults for other basic html elements go here. This section is usually pretty minimal, because I like to style elements as they come along in the source. That way I have more control over the styles and less overriding to do later on.</p>
<p><strong>3. Structure</strong><br />
You might opt to let this section go, depending on whether you like to separate the container divs from other styles or not.</p>
<p><strong>4. Header</strong><br />
The definitions for styling the header of your site go here.</p>
<p><strong>5. Content</strong><br />
The definitions for styling the content section of your site go here.</p>
<p><strong>6. Footer</strong><br />
The definitions for styling the footer of your site go here and again you might skip this section if your site has no footer.</p>
<p><strong>7. Navigation</strong><br />
The various menus, breadcrumbs indicator, etc.</p>
<p><strong>8. Modules</strong><br />
I use this section to define the separate modules or blocks used on my site. News, polls, events lists, flickr feeds, quick links, and similar sections are usually defined here.</p>
<p><strong>9. Forms</strong><br />
I like to put all the forms in one place, this proved to be a wise decision over time.</p>
<p><strong>10. Custom Classes</strong><br />
I put here various reusable classes that are frequently shared throughout the site. You might not need this section if your site is a simple one, but when it grows too complex, you might find this section handy.</p>
<p><strong>11. Everything Else</strong><br />
All that you can&#8217;t fit anywhere above. Usually this section only ends up only having a few classes.</p>
<p><strong>12. Print Styles</strong><br />
If you don&#8217;t store your print styles in a separate file, this is the place to define them with a @media print block. You should put this section as the last one, as you potentially want to override any previous CSS declaration.</p>
<h3>Sample</h3>
<p>Here is some code from a sample style file. I&#8217;ve omitted most of the code for simplicity sake, but I&#8217;ve left section and sub-section comments in.</p>
<pre style="height:20em;overflow-y:scroll">
<code style="overflow-y: hidden">/*
 *  Table Of Sections
 *
 *  1. Reset
 *  2. Basic Elements
 *  3. Generic Classes
 *  4. Basic Layout
 *  5. Header
 *  6. Content
 *  7. Sidebar
 *  8. Footer
 *  9. Navigation
 * 10. Forms
 * 11. Modules
 * 12. Print styles
 *
 */

/* Reset  - do NOT modify!
-------------------------------------*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body { line-height: 1; }
ol, ul { list-style: none; }
blockquote, q {	quotes: none; }

/* remember to define focus styles! */
:focus { outline: 0; }

/* remember to highlight inserts somehow! */
ins { text-decoration: none; }
del { text-decoration: line-through; }

/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}

/* Basic Elements
-------------------------------------*/
html, body { height: 100%; }

body {
	font-family: helvetica, arial, sans-serif;
	font-size: 62.5%; /* 1em = 10px */
	line-height: 1.5em;
	color: #333;
	background: gray;
}

/* Generic Classes
-------------------------------------*/
/* --- Link list --- */
/* --- News list --- */
/* --- Attachments list --- */
/* --- Links --- */
/* --- Messages --- */
/* --- photo frame &amp; content photos --- */
/* --- Other --- */

/* Basic Layout
-------------------------------------*/

/* Header
-------------------------------------*/

/* Content
-------------------------------------*/
/* external link */
/* --- video --- */
/* --- unsorted list --- */
/* --- numbered list --- */
/* --- tables --- */
/* --- Icons in content --- */
/* --- Search results --- */
/* --- Photogallery --- */
/* --- News --- */

/* Sidebar
-------------------------------------*/

/* Footer
-------------------------------------*/

/* Navigation
-------------------------------------*/
/* --- Breadcrumbs --- */
/* --- Sitemap --- */
/* --- Main Menu --- */

/* Forms
-------------------------------------*/

/* Modules
-------------------------------------*/
/* --- News --- */
/* --- FAQ --- */
/* --- Poll --- */
/* --- Quick links --- */

/* Print styles
-------------------------------------*/
@media print {

	/* Your print styles go here */

}</code>
</pre>
<p>So, here it is &#8211; a nice organized layout for your CSS declarations. I hope you find it useful as much as I did and I&#8217;d love to hear from you if you have any comments or suggestions to improve this.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/130" rel="bookmark" class="crp_title">Quick Tip #1 &#8211; Tame those ems</a></li><li><a href="http://scarfoo.com/archives/11" rel="bookmark" class="crp_title">CSS Tip #1 &#8211; Avoiding Hacks With IE Conditional Comments</a></li><li><a href="http://scarfoo.com/archives/38" rel="bookmark" class="crp_title">Development Diary: 4 Tips on Working With Fluid Layouts</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/152/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web Fonts Now, for real  –   Jeffrey Zeldman Presents The Daily Report</title>
		<link>http://scarfoo.com/archives/242</link>
		<comments>http://scarfoo.com/archives/242#comments</comments>
		<pubDate>Fri, 17 Jul 2009 06:26:15 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[web fonts]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=242</guid>
		<description><![CDATA[David Berlow of The Font Bureau has proposed a Permissions Table for OpenType that can be implemented immediately to turn raw fonts into web fonts without any wrappers or other nonsense. If adopted, it will enable type designers to license their work for web use, and web designers to create pages that use real fonts [...]]]></description>
			<content:encoded><![CDATA[<p>David Berlow of The Font Bureau has proposed a Permissions Table for OpenType that can be implemented immediately to turn raw fonts into web fonts without any wrappers or other nonsense. If adopted, it will enable type designers to license their work for web use, and web designers to create pages that use real fonts via the CSS @font-face standard.</p>
<p>via <a href='http://www.zeldman.com/2009/07/16/web-fonts-now-for-real/'>Web Fonts Now, for real  –   Jeffrey Zeldman Presents The Daily Report</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/239" rel="bookmark" class="crp_title">Finally Real And Legal Fonts With Typekit?</a></li><li><a href="http://scarfoo.com/archives/268" rel="bookmark" class="crp_title">Flash, iPad, Standards  –   Jeffrey Zeldman Presents The Daily Report</a></li><li><a href="http://scarfoo.com/archives/62" rel="bookmark" class="crp_title">Webfonts.info &#8211; Fonts Embedding</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/242/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finally Real And Legal Fonts With Typekit?</title>
		<link>http://scarfoo.com/archives/239</link>
		<comments>http://scarfoo.com/archives/239#comments</comments>
		<pubDate>Fri, 29 May 2009 06:44:35 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[web fonts]]></category>
		<category><![CDATA[Legal]]></category>
		<category><![CDATA[Typekit]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=239</guid>
		<description><![CDATA[Looks like the guys over at Typekit have found a way to legally provide us with a large library of fonts and a simple way of integrating them in our web pages. If this proves to be the truth and not a scam, I&#8217;m really wanting to know the details. As the authors put it: [...]]]></description>
			<content:encoded><![CDATA[<p>Looks like the guys over at Typekit have found a way to legally provide us with a large library of fonts and a simple way of integrating them in our web pages. If this proves to be the truth and not a scam, I&#8217;m really wanting to know the details. As the authors put it:</p>
<p><em>As a Typekit user, you’ll have access to our library of high-quality fonts. Just add a line of JavaScript to your markup, tell us what fonts you want to use, and then craft your pages the way you always have. Except now you’ll be able to use real fonts. This really is going to change web design.</em></p>
<p>via <a href='http://blog.typekit.com/2009/05/27/introducing-typekit/#comment-254'>Introducing Typekit « The Typekit Blog</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/273" rel="bookmark" class="crp_title">Google is going Fontalicious!</a></li><li><a href="http://scarfoo.com/archives/242" rel="bookmark" class="crp_title">Web Fonts Now, for real  –   Jeffrey Zeldman Presents The Daily Report</a></li><li><a href="http://scarfoo.com/archives/19" rel="bookmark" class="crp_title">New Scarf*oo Blog Theme</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/239/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Universal Internet Explorer 6 CSS</title>
		<link>http://scarfoo.com/archives/235</link>
		<comments>http://scarfoo.com/archives/235#comments</comments>
		<pubDate>Thu, 21 May 2009 11:08:33 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[readable]]></category>
		<category><![CDATA[universal CSS]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=235</guid>
		<description><![CDATA[Too bad that there are still many clients running and demanding your product to run on IE6. At least in my case, 80% of the clients are of the aforementioned sort and I am in no position to change that. It&#8217;s a sad sad thing really. Someone should really write a conditionally included universal CSS [...]]]></description>
			<content:encoded><![CDATA[<p>Too bad that there are still many clients running and demanding your product to run on IE6. At least in my case, 80% of the clients are of the aforementioned sort and I am in no position to change that. It&#8217;s a sad sad thing really.</p>
<p>Someone should really write a conditionally included universal CSS file to handle IE6 bugs and just be off with it. On the other hand, there are other approaches such as providing a universal readable and pleasant style just for IE6 users and hoping the clients will be happy with it.</p>
<p>Check the proposed style in question at <a href='http://forabeautifulweb.com/blog/about/universal_internet_explorer_6_css/'>Universal Internet Explorer 6 CSS | For A Beautiful Web</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/11" rel="bookmark" class="crp_title">CSS Tip #1 &#8211; Avoiding Hacks With IE Conditional Comments</a></li><li><a href="http://scarfoo.com/archives/259" rel="bookmark" class="crp_title">CSS Differences in Internet Explorer 6, 7 and 8 «  Smashing Magazine</a></li><li><a href="http://scarfoo.com/archives/270" rel="bookmark" class="crp_title">A Sad Day For Rock And Roll.</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/235/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interview with Ian Hickson, editor of the HTML 5 specification. &#8211; The Web Standards Project</title>
		<link>http://scarfoo.com/archives/233</link>
		<comments>http://scarfoo.com/archives/233#comments</comments>
		<pubDate>Wed, 13 May 2009 11:00:09 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[accessibility]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=233</guid>
		<description><![CDATA[Interview with Ian Hickson, editor of the HTML 5 specification. &#8211; The Web Standards Project. A lengthy interview on HTML5 and accessibility – well worth reading. Related Posts:Opera Web Standards CurriculumWordPress 2.5 is here!Looking into HTML5 : Christopher SchmittPowered by Contextual Related Posts]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.webstandards.org/2009/05/13/interview-with-ian-hickson-editor-of-the-html-5-specification/'>  Interview with Ian Hickson, editor of the HTML 5 specification. &#8211; The Web Standards Project</a>. A lengthy interview on HTML5 and accessibility – well worth reading.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/64" rel="bookmark" class="crp_title">Opera Web Standards Curriculum</a></li><li><a href="http://scarfoo.com/archives/43" rel="bookmark" class="crp_title">WordPress 2.5 is here!</a></li><li><a href="http://scarfoo.com/archives/155" rel="bookmark" class="crp_title">Looking into HTML5 : Christopher Schmitt</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/233/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hiding with CSS: Problems and solutions &#124; 456 Berea Street</title>
		<link>http://scarfoo.com/archives/231</link>
		<comments>http://scarfoo.com/archives/231#comments</comments>
		<pubDate>Wed, 06 May 2009 06:21:51 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[display:none]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=231</guid>
		<description><![CDATA[An interesting short article on the pitfalls of using CSS to hide page elements: Hiding with CSS: Problems and solutions &#124; 456 Berea Street. Personally, for elements where accessibility matters, like navigation menus, etc. I prefer hiding those elements with a short javascript statement I put right after the element I want to hide. This [...]]]></description>
			<content:encoded><![CDATA[<p>An interesting short article on the pitfalls of using CSS to hide page elements: <a href='http://www.456bereastreet.com/archive/200905/hiding_with_css_problems_and_solutions/'>Hiding with CSS: Problems and solutions | 456 Berea Street</a>.</p>
<p>Personally, for elements where accessibility matters, like navigation menus, etc. I prefer hiding those elements with a short javascript statement I put right after the element I want to hide. This way the user does not notice the element getting closed and best of all, it remains accessible to all.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/266" rel="bookmark" class="crp_title">Forgotten CSS selectors | 456 Berea Street</a></li><li><a href="http://scarfoo.com/archives/179" rel="bookmark" class="crp_title">NVDA – a free, open source screen reader | 456 Berea Street</a></li><li><a href="http://scarfoo.com/archives/111" rel="bookmark" class="crp_title">The Solution to Your IE PNG Background Problems</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/231/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The CSS Box Model &#8211; Back to The Basics</title>
		<link>http://scarfoo.com/archives/149</link>
		<comments>http://scarfoo.com/archives/149#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:55:12 +0000</pubDate>
		<dc:creator>Damjan Mozetič</dc:creator>
				<category><![CDATA[back to the basics]]></category>
		<category><![CDATA[box model]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://scarfoo.com/?p=149</guid>
		<description><![CDATA[Welcome to the second part of the Back to The Basics series of articles here on Scarf*oo. Back to The Basics focuses &#8211; in simple terms &#8211; on the basic stuff every web developer should be familiar with. In the first Back to The Basics article we covered the shorthand CSS notation. Today, we&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to the second part of the Back to The Basics series of articles here on Scarf*oo. Back to The Basics focuses &#8211; in simple terms &#8211; on the basic stuff every web developer should be familiar with. In the <a href="http://scarfoo.com/archives/212">first Back to The Basics article</a> we covered the shorthand CSS notation. Today, we&#8217;ll be looking at the obscure box model and what does it mean to us and how can we manipulate it.</p>
<p><span id="more-149"></span></p>
<h3>The Box Model</h3>
<p>The box model is a term used when referring to the rectangular boxes placed around every element in the page source (source document). It is one of the most basic concepts <strong>every</strong> web designer should know by heart.</p>
<p>The box model is constructed with the following boxes or layers:</p>
<p><img src="http://scarfoo.com/wp-content/uploads/2009/04/box-model.gif" alt="Box Model" title="Box Model" width="323" height="223" class="alignnone size-full wp-image-200" /></p>
<p><b>1. Content</b><br />
The innermost part of the box is the html element itself <em>or content</em>, such as &#8220;&lt;div&gt;&#8221;, &#8220;&lt;p&gt;&#8221;, &#8220;&lt;h1&gt;&#8221;, &#8220;&lt;ul&gt;&#8221; &#8230; etc. The CSS <em>width</em> property defines the width of this element, similar goes for the height.</p>
<pre>
<code>div {
    position: absolute;
    width: 150px; /* set the div element to be 150 pixels wide... */
    height: 40px; /* ... and 40 pixels tall */
}</code>
</pre>
<p><b>2. Padding</b><br />
Next we have the <em>padding</em> property, which is the first layer you&#8217;d encounter going outwards from the actual element covered in the previous point.</p>
<pre>
<code>div {
    position: absolute;
    width: 150px;
    height: 40px;
    padding: 30px 20px 30px 20px; /* add 30 pixels to the top and bottom, and 20 pixels to the left and right padding */
}</code>
</pre>
<p><b>3. Border</b><br />
The middle layer in the box model is the element&#8217;s <em>border</em>. The space used by the border in the box model is the thickness of the border.</p>
<pre>
<code>div {
    position: absolute;
    width: 150px;
    height: 40px;
    padding: 30px 20px 30px 20px;
    border: 1px solid #EFD5B4; /* add a solid 1 pixel thick border with the #EFD5B4 color */
}</code>
</pre>
<p>Above I&#8217;ve used a shorthand notation to define the border&#8217;s <em>thickness</em>, <em>style</em> and <em>color</em>. If you wanted, you could break down each of these three properties into their top, right, bottom and left components, but I&#8217;m not going into that in this tutorial. You can read more on shorthand notations in the first Back to The Basics article, <a href="http://scarfoo.com/archives/212">The Shorthand CSS Notation Explained</a>.</p>
<p><b>4. Margin</b><br />
Then we have the <em>margin</em>, which is the space just outside the border.</p>
<pre>
<code>div {
    position: absolute;
    width: 150px;
    height: 40px;
    padding: 30px 20px 30px 20px;
    border: 1px solid #EFD5B4;
    margin: 30px; /* add a 30 pixels margin around the element */
}</code>
</pre>
<p>Perhaps it is in order to mention that there are some bugs associated with proper margin handling in certain browsers, particularly <abbr title="Microsoft Internet Explorer">IE</abbr> 5 and 6. One of the nastiest bugs is the doubled margin bug, which basically doubles the left and/or right margin if the element is floated. Thankfully this bug has been squashed in <abbr title="Microsoft Internet Explorer">IE</abbr> 7. For a quick fix to this bug, take a look at the last tip in the article <a href="http://scarfoo.com/archives/16">5 CSS Tips to Make IE (You) Happy</a></p>
<p>The sum of the layers above &#8211; left and right margins, border, padding, and the content width &#8211; defines the total box width. Similarly, the sum of the top and bottom margins, border, padding, and the content height defines the total box height. Take in consideration this model when specifying margins, borders and paddings to elements &#8211; basically, everything adds to the width/height of the element.</p>
<p><b>5. Position</b><br />
Lastly we have the position of the element, which is measured from around the bounds of the margin of the element. The position is set with the <em>top</em>, <em>right</em>, <em>bottom</em> and <em>left</em> CSS properties.</p>
<pre>
<code>div {
    position: absolute;
    width: 150px;
    height: 40px;
    padding: 30px 20px 30px 20px;
    border: 1px solid #EFD5B4;
    margin: 30px;
    top: 10px; /* move the element 10 pixels down from the parent element box */
    left: 10px; /* move the element 10 pixels right from the parent element box */
}</code>
</pre>
<h3>Conclusion</h3>
<p><img src="http://scarfoo.com/wp-content/uploads/2009/04/box-model-firebug.gif" alt="Box Model - Firebug" title="Box Model - Firebug" width="320" height="270" class="alignnone size-full wp-image-202" /></p>
<p>I recommend you to install <a href="http://getfirebug.com/">Firebug</a>, a great web development plugin for Firefox. Firebug has a useful box model view represented in the image above.</p>
<p>There are tons of details if you want to dig deeper into the box model. If you want to know more, visit <a href="http://www.w3.org/TR/CSS2/box.html">The Box Model document</a> and the <a href="http://www.w3.org/TR/CSS2/visudet.html">Visual formatting model details document</a>, both located over at <a href="http://www.w3.org/">W3.org</a>.</p>
<p>Thanks for reading!</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://scarfoo.com/archives/212" rel="bookmark" class="crp_title">The Shorthand CSS Notation Explained &#8211; Back to The Basics</a></li><li><a href="http://scarfoo.com/archives/13" rel="bookmark" class="crp_title">CSS Tip #2 &#8211; Accessible Image Replacement Technique</a></li><li><a href="http://scarfoo.com/archives/38" rel="bookmark" class="crp_title">Development Diary: 4 Tips on Working With Fluid Layouts</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://scarfoo.com/archives/149/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
