<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Kilian Valkhof</title>
	
	<link>http://kilianvalkhof.com</link>
	<description />
	<pubDate>Tue, 26 Aug 2008 10:57:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Kilianvalkhofcom" type="application/rss+xml" /><item>
		<title>The CSS3 :not() selector</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/374076281/</link>
		<comments>http://kilianvalkhof.com/2008/css-xhtml/the-css3-not-selector/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 08:11:07 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[CSS &amp; (X)HTML]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=135</guid>
		<description><![CDATA[<blockquote><p>The <code>:not()</code> selector is only supported by modern browsers, <code>:not(IE)</code>.</p></blockquote>]]></description>
			<content:encoded><![CDATA[<p>There isn&#8217;t a lot of information to be found about the <code>:not()</code> selector. The specifications only offer 3 lines of text and a couple of examples. So lets see what it can do!<span id="more-135"></span></p>
<h3>The Specification</h3>
<blockquote><p>The negation pseudo-class, :not(X), is a functional notation taking a simple selector [&hellip;] as an argument. It represents an element that is not represented by the argument. </p></blockquote>
<p>What it says here, is that a selector with a <code>:not()</code> in it will match all elements that <em>do not</em> match what&#8217;s between the parenthesis. </p>
<p>A simple selector is a term used in the specifications. A simple selector is: a single element, attribute selector, class, id or pseude-class.</p>
<p>Examples of simple selectors:</p>
<pre><code>body
*
[value="foo"]
.foo
#foo
:hover</code></pre>
<p>Basically, any of the above type, but with only <em>one</em> selector. </p>
<h3>The browsers</h3>
<p>The <code>:not()</code> selector is only supported by modern browsers (Firefox, Safari and Opera), <code>:not(IE)</code>.</p>
<p>Let&#8217;s take a look at what browsers allow you to do:</p>
<pre><code>div:not(.home) {&hellip;}</code></pre>
<p>This selects all div elements that do not have the class <code>.home</code></p>
<pre><code>div *:not(p) em {&hellip;}</code></pre>
<p>This selects all em elements that are in an element (that is not a p element) and that are in a div element. so <code>&lt;div&gt;&lt;strong&gt;&lt;em&gt;&hellip;&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;</code> is a match, but <code>&lt;div&gt;&lt;p&gt;&lt;em&gt;&hellip;&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;</code> is not.</p>
<pre><code>input:not([type="file"]) {&hellip;}</code></pre>
<p>This uses the attribute selector to select all input element, save for the file upload ones. </p>
<p>I was surprised to find out that</p>
<pre><code>h2:not(.foo, .bar) {&hellip;}</code></pre>
<p>also works. You can give the <code>:not()</code> selector a comma separated list as well! (Tested in Firefox 3) This is surprising, because it&#8217;s not documented as such in the specifications.</p>
<p>You can use the <code>:not()</code> selector as a part of a large selector. I&#8217;ve done this a few times in my current design:</p>
<pre><code>li:not(.pingback) .comment-content p:first-child:first-line {&hellip;}
body:not(.home) h2 + p:first-letter {&hellip;}
.post:not(.first-post) a:hover {&hellip;}</code></pre>
<p>The <code>:not()</code> selector is a nice addition to the CSS Tookit, and it can already be used in a way that allows for graceful degradation, such as I do on this website. If you have any nice experiences with <code>:not()</code>, please share them in the comments!</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/css-xhtml/the-css3-not-selector/">The CSS3 :not() selector</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=vvainK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=vvainK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=xYkP1k"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=xYkP1k" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=xG3qrk"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=xG3qrk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=DF6dJK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=DF6dJK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=cgMHgk"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=cgMHgk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=hRFrsK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=hRFrsK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=rKNRSK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=rKNRSK" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/css-xhtml/the-css3-not-selector/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/css-xhtml/the-css3-not-selector/</feedburner:origLink></item>
		<item>
		<title>Popular posts for Wordpress 2.6</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/367656407/</link>
		<comments>http://kilianvalkhof.com/2008/wordpress/popular-posts-for-wordpress-26/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 01:00:27 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=130</guid>
		<description><![CDATA[<blockquote><p>I wanted something that wasn't so common, so I had to make something for myself.</p></blockquote>]]></description>
			<content:encoded><![CDATA[<p>On my homepage, I have the three most popular posts. Finding a plugin that did what I wanted <em>and</em> that worked with Wordpress 2.6 proved to be quite impossible.<span id="more-130"></span></p>
<p>I wanted something that wasn&#8217;t so common: display the title, category, date, comments <em>and</em> excerpt, so I had to make something for myself.</p>
<h3>What it does</h3>
<p>At the moment, it&#8217;s quite basic. It sorts the posts on comment count, and displays the top <em>n</em> articles. I have three on my homepage. It uses the excellent <a href="http://rmarsh.com/plugins/">post plugin library</a> to get the date, category and excerpt into shape. (so, the post plugin library is needed for this to work). The code is based off of <a href="http://wordpress.org/support/topic/188045">this example</a> from the Wordpress forums.</p>
<h3>The Code</h3>
<p>I haven&#8217;t looked into making wordpress plugins yet, so my popular post solution is just a snippet you can include in your theme:</p>
<pre><code>&lt;?php
	$sql='SELECT post_title, comment_count, guid, post_date, post_content, ID
	      FROM wp_posts
	      ORDER BY comment_count DESC
	      LIMIT 3;';
	$popresults = $wpdb-&gt;get_results($sql);

	foreach ($popresults as $r) {
		echo '&lt;div class="post"&gt;';
		echo '	&lt;h3&gt;&lt;a href="' . $r-&gt;guid . '"&gt;' . $r-&gt;post_title .'&lt;/a&gt;';
		echo '		&lt;span&gt;'. otf_categorylinks($r-&gt;ID, $r,', ').',';
		echo '			&lt;abbr title="'. oth_format_date($r-&gt;post_date, "j F Y") . '"&gt;'. oth_format_date($r-&gt;post_date, "j/m") . '&lt;/abbr&gt;,';
		echo '			&lt;abbr title="' . $r-&gt;comment_count . ' comments"&gt;' . $r-&gt;comment_count . '&lt;/abbr&gt;';
		echo '		&lt;/span&gt;';
		echo '	&lt;/h3&gt;';
		echo '	&lt;p&gt;'. oth_trim_excerpt($r-&gt;post_content, '45') .'…&lt;/p&gt;';
		echo '&lt;/div&gt;';
	}
?&gt;</code></pre>
<p>This snippet can be improved in a lot of ways. For one, making it a plugin would be a good idea. Secondly, attaching a time-based element would be nice, so that it can become &#8220;the popular posts of last month&#8221; instead of the all-time popular posts. Even more interesting would be linking it to the <a href="http://wordpress.org/extend/plugins/stats/">WP-Stats</a> plugin. That offers an &#8220;active posts&#8221; lists, which seems to be based off of comments and visits to a certain posts over a limited period of time.</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/wordpress/popular-posts-for-wordpress-26/">Popular posts for Wordpress 2.6</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=yPQULK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=yPQULK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=1rtIik"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=1rtIik" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=3dO67k"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=3dO67k" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=HbQ42K"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=HbQ42K" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=YVA0nk"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=YVA0nk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=jh4Q0K"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=jh4Q0K" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=87QoBK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=87QoBK" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/wordpress/popular-posts-for-wordpress-26/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/wordpress/popular-posts-for-wordpress-26/</feedburner:origLink></item>
		<item>
		<title>My first design is finally done</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/363934659/</link>
		<comments>http://kilianvalkhof.com/2008/design/my-first-design-is-finally-done/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 14:23:05 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=99</guid>
		<description><![CDATA[<blockquote><p>This site is made with a <strong>screw IE</strong> attitude</p></blockquote>]]></description>
			<content:encoded><![CDATA[<p>After over a year and a half, I finally have a design of my own. It&#8217;s been announced way too many times, but now it&#8217;s really here. Find out what happened to the tagline, after the break!<span id="more-99"></span></p>
<h3>Design wise</h3>
<p>This is actually the first design I made on a Linux machine (<em>nerd</em>), and the first design that went directly from sketch to html. My sketches were more detailed because of this, and I might add them to the article later, when I have a good camera at hand. In any case it means I didn&#8217;t buy fancy pencils for nothing :) Most of the typography was actually sketched out, instead of added as an afterthought. The header is set in <a href="http://www.insignedesign.com/Typeface.aspx?FamilyName=Asturias">Asturias</a>.</p>
<p>Besides that, the whole website adheres to a vertical rhythm of 18px (even my form elements!), largely the cause of the <em>awesome</em> <a href="http://sencss.kilianvalkhof.com">SenCSs</a>. There is a pretty strict grid as well. It might seem quite small if you have a fancy 24&#8243; monitor, but since I have an Asus EEE, I wanted it to work on there as well. I can create 1, 2, 3 or 4 columns within my style, with space to the right of the design where I can put extra stuff. I might experiment with that in time.</p>
<p>I&#8217;m using my <a href="http://kilianvalkhof.com/2008/css-xhtml/context-hover-adding-context-feedback-to-your-links/">Context Hover</a> javascript trick as well,  I think it works very nice on this site.</p>
<p>I liked the idea of having as little administrative cruft available as possible, and initially didn&#8217;t have a search form at all. This is functionality I wanted to offer though, so I settled for what you currently see. It&#8217;s in the top right corner with <code>position:fixed</code>, more part of the browser window (right below your google search bar) than my website. Huzzah! I also removed the sharing options, and made the meta information as small and invisible as possible.</p>
<p>Oh, and about the tagline, it&#8217;s still there for those who look :)</p>
<h3>Code Wise</h3>
<p>Yep, I used SenCSs for this design, and that took away about 50% of the styling needs. I&#8217;m so happy with developing it :) There are probably some things here and there that I&#8217;m going to change in SenCSs 0.4.7, or, if I can finish the form part, they&#8217;ll go straight into 0.5 :) (0.5 being the first version to include form styling). </p>
<p>HTML-wise it&#8217;s quite boring. xhtml strict, nothing spectacular. I went down a scale in headings in articles. (So what was <code>h2</code> with the old design will be <code>h3</code> in the new design.) Will be interesting to see what Google thinks of that&hellip;</p>
<p>I&#8217;m also happy to tell you that this site is made with a <strong>screw IE</strong> attitude. I can do this, because IE users are only about 15% of my visitors. Most of the site will work for them, the fancy stuff won&#8217;t. What fancy stuff, you ask? Well, That would be fancy CSS selectors such as these:</p>
<pre><code>h2 + p:first-line
.first-post > p:first-line
.comment-form .left ~ button
<a href="http://kilianvalkhof.com/2008/css-xhtml/your-best-css-selector/">li:not([class=pingback]) .comment-content p:first-child:first-letter</a></code></pre>
<p>I&#8217;m using the <a href="http://rmarsh.com/plugins/similar-posts/">similar posts plugin</a> to display related posts at the bottom of my articles, which works pretty well and I find myself browsing through my backlog, so I hope you will, too. :)</p>
<p>On the homepage I have the three most popular posts. Anyone that has searched for a plugin to take care of that and works with Wordpress 2.6 probably found out there isn&#8217;t one. So I had to make my own little snippet* that uses the post options plugin. I&#8217;ll post an article with the code in the next couple of days. *<em>my Wordpress-fu isn&#8217;t good enough to develop plugins yet</em></p>
<h3>More than a weblog</h3>
<p>I like the idea of this just being a weblog, but I am also a freelancer, and wouldn&#8217;t mind showcasing that on my site a bit more. So the <a href="#">projects</a> page will include both open source and client work. I got some cool things lined up for release. On the homepage I&#8217;m displaying a list of projects I developed or am involved with. Currently that&#8217;s just SenCSs, but expect that to fill up in the near future. </p>
<h3>Your Thoughts?</h3>
<p>I&#8217;m quite interested in your thoughts on the design and the website in general, let me know in the comments and if you&#8217;re browser is hot enough, I&#8217;ll give you a sweet <code>:first-letter</code> and <code>first-line</code> effect! ;)</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/design/my-first-design-is-finally-done/">My first design is finally done</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=zRLXkK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=zRLXkK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=12svdk"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=12svdk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=7m1qkk"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=7m1qkk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=HZ0g3K"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=HZ0g3K" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=GTQg2k"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=GTQg2k" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=1awOzK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=1awOzK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=OcXI2K"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=OcXI2K" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/design/my-first-design-is-finally-done/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/design/my-first-design-is-finally-done/</feedburner:origLink></item>
		<item>
		<title>Your best CSS selector?</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/355364999/</link>
		<comments>http://kilianvalkhof.com/2008/css-xhtml/your-best-css-selector/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 14:15:29 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[CSS &amp; (X)HTML]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=91</guid>
		<description><![CDATA[I am making great progress on my new design, and one of the decisions I made was to just forget about IE and use all the css I want. This lead to perhaps the best CSS selector I have ever written:
li:not([class=pingback]) .comment-content p:first-child:first-letter

Which is one of the selectors I use to style the comment section [...]]]></description>
			<content:encoded><![CDATA[<p>I am making great progress on my new design, and one of the decisions I made was to just forget about IE and use all the css I want. This lead to perhaps the best CSS selector I have ever written:<span id="more-91"></span></p>
<pre><code>li:not([class=pingback]) .comment-content p:first-child:first-letter
</code></pre>
<p>Which is one of the selectors I use to style the comment section of my new design. Not bad, is it? </p>
<p><em>Sorry for the delay on the second part of <a href="http://kilianvalkhof.com/2008/javascript/building-your-own-lightbox-part-1/">Building your own lightbox</a>. The article is proving itself to be, how do I say it, <em>humongous</em>.</em></p>
<p>So, for this week, <strong>Tell me your best CSS selector!</strong></p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/css-xhtml/your-best-css-selector/">Your best CSS selector?</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=LHdd2K"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=LHdd2K" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=USzqbk"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=USzqbk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=Szbpak"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=Szbpak" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=V4FgIK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=V4FgIK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=WLTDLk"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=WLTDLk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=kJy2WK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=kJy2WK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=nBv2iK"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=nBv2iK" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/css-xhtml/your-best-css-selector/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/css-xhtml/your-best-css-selector/</feedburner:origLink></item>
		<item>
		<title>SenCSs 0.4.6 Released</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/348221012/</link>
		<comments>http://kilianvalkhof.com/2008/sencss/sencss-046-released/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 09:27:01 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[SenCSs]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=82</guid>
		<description><![CDATA[I just released SenCSs 0.4.6, which adds some fixed and refinement of styles, and adds  table styling. I also developed a logo for it and I thought it would be nice to show all the intermediary steps that lead up to the finished product. Click through for the links, the logo, the concepts and [...]]]></description>
			<content:encoded><![CDATA[<p>I just released SenCSs 0.4.6, which adds some fixed and refinement of styles, and adds <strong> table styling</strong>. I also developed a logo for it and I thought it would be nice to show all the intermediary steps that lead up to the finished product. Click through for the links, the logo, the concepts and a request! <span id="more-82"></span></p>
<div style="float:left;width:49%;background:#fff;">
<h2>The concepts</h2>
<p><img src="/uploads/concepts.png" alt="" />
</div>
<h2>SenCSS 0.4.6</h2>
<p>You can download SenCSs 0.4.6, both the normal and the minified version, from <a href="http://code.google.com/p/sencss/">Google code</a>. Have a look over at the <a href="http://sencss.kilianvalkhof.com">SenCSs website</a> for the full changelog and more information.</p>
<h2>The final logo</h2>
<p><img src="http://sencss.kilianvalkhof.com/sencss.png" alt="" /></p>
<h2>A Request</h2>
<p>Wanna help work on SenCSs? I&#8217;m fighting with <strong>form styling</strong> and making it <strong>cross browser pixel perfect</strong> (a utopia?). If you see any parts of SenCSs that can be improved, or if you have good ideas that should/can/must be added, don&#8217;t hesitate to contact me using <a href="#comments">The comments here</a>, <a href="/contact">my contact form</a>, or <a href="http://twitter.com/kilianvalkhof">Twitter</a>. Cheers!</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/sencss/sencss-046-released/">SenCSs 0.4.6 Released</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=jeN3VJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=jeN3VJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=coU6ij"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=coU6ij" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=h2lwaj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=h2lwaj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=aeJI8J"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=aeJI8J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=N2dAEj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=N2dAEj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=HU77kJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=HU77kJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=u4XcZJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=u4XcZJ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/sencss/sencss-046-released/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/sencss/sencss-046-released/</feedburner:origLink></item>
		<item>
		<title>Building your own lightbox - part 1</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/343058729/</link>
		<comments>http://kilianvalkhof.com/2008/javascript/building-your-own-lightbox-part-1/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 01:00:29 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=78</guid>
		<description><![CDATA[A lightbox is a way of showing an image, a movie or an entire web page as an overlay on a website. It is often used in gallery style websites and for portfolio&#8217;s. This article will look into the basics of building your own lightbox for images.
Part 2, published next week, will look into some [...]]]></description>
			<content:encoded><![CDATA[<p>A lightbox is a way of showing an image, a movie or an entire web page as an overlay on a website. It is often used in gallery style websites and for portfolio&#8217;s. This article will look into the basics of building your own lightbox for images.<span id="more-78"></span></p>
<p>Part 2, published next week, will look into some of the cooler stuff:</p>
<ul>
<li>Loading in pages instead of images</li>
<li>Adding a loading animation</li>
<li>Adding a nice close button</li>
<li>Using cool different animations</li>
<li>Send some text along with an image and display it next to it</li>
<li><strong>Display multiple lightboxes on top of each other</strong></li>
<li>Combining all the above</li>
</ul>
<h2>Why an article on making a lightbox?</h2>
<p>I know, I know, there are a lot of really good lightbox scripts out there already (check out the <a href="http://planetozh.com/projects/lightbox-clones/">comparison matrix</a>!) However, during my internship I developed a <a href="http://www.headline-interactive.nl">website</a> that needed some very specific lightbox effects, and none of the existing lightbox scripts did what I wanted them to do. It was really fun to build one on my own, so I thought I&#8217;d let you share in the excitement ;)</p>
<h2>Let&#8217;s get started!</h2>
<p>Whenever I develop something, I first take a couple of steps back and make a list of all the actions that I need to perform that together make the complete effect I want to achieve.</p>
<p>The actions that happen when opening a lightbox:</p>
<ol>
<li>User clicks on a link designated as a lightbox link</li>
<li>A Javascript event handler picks up on it</li>
<li>Two extra elements get added into the DOM:
<ul>
<li>A 100% width and 100% height overlay</li>
<li>A container for the image/movie/page getting loaded</li>
</ul>
</li>
<li><code>overflow-y:hidden</code> gets added to the body to prevent scrolling</li>
<li>An ajax call is made to retrieve the <code>href</code> of the link</li>
<li>Javascript makes the loaded content visible and positions it as soon as it&#8217;s loaded</li>
<li>The Javascript does a <code>return false</code> to make sure the regular link doesn&#8217;t fire as well</li>
</ol>
<p>jQuery, the library I used to develop the lightbox, makes it trivially easy, so lets start. Throughout the article, we&#8217;ll be working with this link:</p>
<pre><code>
&lt;a href="http://kilianvalkhof.com/uploads/lightbox.jpg" class="lightbox"&gt;open lightbox!&lt;/a&gt;

</code></pre>
<h4>1. The event handler</h4>
<pre><code>
$(".lightbox").click(function() {
	window.startOverlay();
});

</code></pre>
<p>&#8220;Find the elements with class &#8220;lightbox&#8221;, and if someone clicks on one of them, execute the function <code>window.startOverlay</code>.&#8221; </p>
<p>The only problem with the code above is that I don&#8217;t specify which link gets clicked. So we have to get the contents of the <code>href</code> attribute and send it along as a parameter:</p>
<pre><code>
$(".lightbox").click(function(){
	overlayLink = $(this).attr("href");
	window.startOverlay(overlayLink);
});

</code></pre>
<h4>2. Get the DOM ready</h4>
<p>As I said in the list above, I need two new elements, and i need to prevent the viewport from scrolling.</p>
<pre><code>
function startOverlay(overlayLink) {
	$("body")
		.append('&lt;div class="overlay"&gt;&lt;/div&gt;&lt;div class="container"&gt;&lt;/div&gt;')
		.css({"overflow-y":"hidden"});
	&hellip;
}

</code></pre>
<p>Now all the needed elements are in the DOM and ready to be used. However, the newly made elements have no style yet, so we need to add some CSS to our stylesheet:</p>
<pre><code>
.overlay {
	position:absolute;
	top:0;
	left:0;
	height:100%;
	width:100%;
	background:#000;
	opacity:0;
	filter:alpha(opacity=0);
	z-index:50;
}
.container {
	position:absolute;
	opacity:0;
	filter:alpha(opacity=0);
	left:-9999em;
	z-index:51;
}

</code></pre>
<p>The two odd things here are the fact that all opacity is set to zero, and that <code>.container</code> is way, <em>way</em> to the left. That is because the actual content hasn&#8217;t loaded yet, so we just hide it all for now.</p>
<p>We need to make the semitransparent overlay visible however, and for that we use a fade. (You can use any other animation too, but the fade-in just looks the best, IMO);</p>
<pre><code>
function startOverlay(overlayLink) {
	&hellip;
	$(".overlay").animate({"opacity":"0.6"}, 200, "linear");
	&hellip;
}

</code></pre>
<p>This tells jQuery to animate the opacity from the current value (zero) to 0.6, do so in 200 milliseconds, and have a linear transitions (part 2, next week, will look into some of the other possible transitions)</p>
<p>After this has happened, we need to load in the content to put in the lightbox. </p>
<h4>3. The Ajax call</h4>
<p>I&#8217;ll tell you a little secret. For the loading of an image, You don&#8217;t actually need an ajax call! You just add the image to the DOM and your browser downloads it automatically. </p>
<p>The &#8220;Ajax&#8221; bit is just this:</p>
<pre><code>
function startOverlay(overlayLink) {
	&hellip;
	$(".container").html('&lt;img src="'+overlayLink+'" alt="" /&gt;');
	&hellip;
}

</code></pre>
<p>The <code>overlayLink</code> is the link of the clicked element that we added into the function as a parameter when someone clicks a link. It doesn&#8217;t work like this with web pages, but we&#8217;ll write something for that, next week.	</p>
<h4>4. Make it visible</h4>
<p>We now have everything set for the <em>grande finale</em>: actually displaying the image!</p>
<p>We need only a little information: the width and height of the image. Then we position the container in the middle of the screen, and fade it in. However, we can&#8217;t just request it, It might still be downloading and then we get the wrong or no dimensions at all. So before doing anything, we need to check whether it has downloaded completely, and only then request the dimensions. Luckily, that is fairly easy:</p>
<pre><code>
function startOverlay(overlayLink) {
	&hellip;
	$(".container img").load(function() {
		var imgWidth = $(".container img").width();
		var imgHeight = $(".container img").height();
		$(".container")
			.css({
				"top":        "50%",
				"left:        "50%",
				"width":      imgWidth,
				"height":     imgHeight,
				"margin-top": -(imgHeight/2),
				"margin-left":-(imgWidth/2) //to position it in the middle
			})
			.animate({"opacity":"1"}, 200, "linear");
	});
}
</code></pre>
<p>The load function get executed as soon as the image has loaded fully. When the image is loaded, we get the right dimensions, position the image and, last but not least, make the image available with a nice fade.</p>
<h4>5. <code>return false;</code></h4>
<p>Now that everything is successful, and you have a working lightbox, you just need to do one last thing: make sure the browser doesn&#8217;t also load the link itself!</p>
<pre><code>
$(".lightbox").click(function() {
	window.startOverlay();
	<strong>return false;</strong>
});

</code></pre>
<h2>Done!</h2>
<p>That&#8217;s it, now we&#8217;re done. We have a working lightbox and all our users are happy. </p>
<p>Not&hellip;? </p>
<p>&hellip;Oh!</p>
<h3>Allowing the user to close the lightbox.</h3>
<p>Of course, a user must be able to close an lightbox as well. This usually happens when someone clicks next to the image, so we&#8217;ll take that method for now. (We&#8217;ll expand on it in part 2.) The actions for closing a lightbox:</p>
<ul>
<li>A user clicks next to the image</li>
<li>An event handler gets fired</li>
<li>Javascript fades the image and the overlay out</li>
<li>Javascript removes the elements from the DOM</li>
</ul>
<p>If you&#8217;ve stuck around &#8217;till here, I think you can manage the code at once:</p>
<pre><code>
$(".overlay").click(function(){
	$(".container, .overlay")
	.animate({"opacity":"0"}, 200, linear, function(){
		$(".container, .overlay").remove();
	})
});

</code></pre>
<p>and for the css, add <code>cursor:pointer;</code> to the <code>.overlay</code> element to give people a visual clue that they can click it.</p>
<p>Pretty easy, no? You can actually define <em>multiple</em> elements in your jQuery selector. Just like in CSS, you can do so with just a simple comma.</p>
<p>The only gotcha here, is that you need to make sure this bit of code is within your lightbox function (see the full example below to see what I mean) otherwise it will not get executed.</p>
<h2>Full code</h2>
<p>To see the full code put together, check out the <a href="http://kilianvalkhof.com/uploads/lightbox/">Demo page</a>.</p>
<p>Remember, next week, we&#8217;ll expand on this a whole lot more, including some very cool stuff like nice animations and multiple lightboxes! See you then! :)</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/javascript/building-your-own-lightbox-part-1/">Building your own lightbox - part 1</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=qRf1FJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=qRf1FJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=YA1qEj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=YA1qEj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=z6B7dj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=z6B7dj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=GuzjKJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=GuzjKJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=fYICFj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=fYICFj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=fijJ5J"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=fijJ5J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=VFLWmJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=VFLWmJ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/javascript/building-your-own-lightbox-part-1/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/javascript/building-your-own-lightbox-part-1/</feedburner:origLink></item>
		<item>
		<title>Why?</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/334646010/</link>
		<comments>http://kilianvalkhof.com/2008/web/why/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 01:00:34 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=77</guid>
		<description><![CDATA[Design critique by clients is one of the hardest things to deal with, because, well, comic sans is not a bloody option. However, you&#8217;re not going to convince them by just saying &#8220;no, that looks really bad&#8221;. You need more information from them, you need their Why.
What&#8217;s up?
There is often a misunderstanding between designers and [...]]]></description>
			<content:encoded><![CDATA[<p>Design critique by clients is one of the hardest things to deal with, because, well, <em>comic sans is <strong>not</strong> a bloody option</em>. However, you&#8217;re not going to convince them by just saying &#8220;no, that looks really bad&#8221;. You need more information from them, you need their <strong>Why</strong>.<span id="more-77"></span></p>
<h2>What&#8217;s up?</h2>
<p>There is often a misunderstanding between designers and clients. Designers want clients to provide an overview of their business goals and client perception and apply their knowledge to make a design fitting with those goals. And clients, clients want more blue. Or yellow. Or mauve.</p>
<p>Dealing with design critique starts right at the beginning of a project. At that time, it&#8217;s best to confront a client with the way you work. what do you expect from them and what can they expect from you. I use a website requirements list that only touches on looks at just one question (asking if they already have ideas for the design themselves) and I&#8217;m considering taking it out. The rest of the questions are all based on their business goals. What do they want the website to achieve, what do they want their visitors to think about them, who do they want their visitors to be (and no, <em>everyone</em> is pretty much never a target audience). Then, the next question is&hellip;</p>
<h2>Why</h2>
<p>Clients say A, but mean B. You hear this a lot, and that&#8217;s because it&#8217;s <strong>true</strong>. There is, however, one question that will lead almost every client from A to B in a quick, painless way. <strong>Why?</strong></p>
<p>Why happens when you craft a perfect design fitting to their every business goal and targeted at precisely their audience, and the client doesn&#8217;t like the colours. You ask them why they don&#8217;t like the colours. Perhaps he discussed his website with his wife, and she really liked hot pink. By explaining why the chosen colours fit with the clients business goals, and thus provide an advantage for them, you can help a client realise you want the best for his business, not the best for his (wife&#8217;s) personal taste.</p>
<p>By asking why, and allowing a client to explain his reasoning, you can show him, in a non-insulting way, that <strong>design is not about personal preferences.</strong></p>
<p>Luckily, however, it might just be that a client has a perfectly valid business reason for wanting hot pink instead of whatever colour you chose. Being able to recieve design critique means that you can objectively decide whether the client is, indeed, right, and hot pink fits their business goals better.</p>
<h2>Just because</h2>
<p>ew. <em>ew</em>. If in any way possible, avoid clients that do not provide solid reasoning and arguments for their critique. If someone can&#8217;t tell my why they do or do not like something, I&#8217;m not listening to them. By asking the why question a lot at the beginning of a project you can easily filter these clients out. Filtering them out doesn&#8217;t always mean not taking them as a client. Sometimes, clients like this are really easy on design choices, and sometimes charging a lil&#8217; more covers the frustration just fine ;)</p>
<p>This is the system I use to handle clients and design critique, What system or method do you use?</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/web/why/">Why?</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=Z0m2NJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=Z0m2NJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=Fvavuj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=Fvavuj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=NZ7K7j"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=NZ7K7j" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=r9EhXJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=r9EhXJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=zVbVLj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=zVbVLj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=M3FtfJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=M3FtfJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=KHoXkJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=KHoXkJ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/web/why/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/web/why/</feedburner:origLink></item>
		<item>
		<title>In Barcelona!</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/333541305/</link>
		<comments>http://kilianvalkhof.com/2008/life/in-barcelona/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 13:58:28 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=76</guid>
		<description><![CDATA[I Arrived in Barcelona two days ago to work for Properazzi. I&#8217;ll be working as a User Experience Designer for two months, living two streets from the beach. my life is so horrible :)
I don&#8217;t know a word of Spanish yet though, so it should be fun! (That&#8217;s not entirely true, but I probably shouldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I Arrived in Barcelona two days ago to work for <a href="http://properazzi.com">Properazzi</a>. I&#8217;ll be working as a User Experience Designer for two months, living two streets from the beach. my life is so horrible :)<span id="more-76"></span></p>
<p>I don&#8217;t know a word of Spanish yet though, so it should be fun! (That&#8217;s not entirely true, but I probably shouldn&#8217;t go around saying <em lang="es">Te amo, bella!</em> to everyone&hellip;)</p>
<h2>Design, design, design</h2>
<p>During this period, my evenings will finaly <strong>not</strong> be filled with extensive client work, and I plan on finally, for the first time since the start of this blog in december 2006, create my own design. I figured that, If I&#8217;m being employed as a User Experience Designer, my own weblog should at least somewhat convey that ;)</p>
<p>I&#8217;ll be living in a city defined by Miro, Dali and Gaudi, so I&#8217;ll just have to keep my eyes open to get inspiration.</p>
<h2>Meetup!</h2>
<p>I don&#8217;t know any people in Barcelona yet (outside of Properazzi) and if you live there, I would love to get to know you. Send me a message though my <a href="http://kilianvalkhof.com/contact">Contact form</a> or add me on <a href="http://www.twitter.com/kilianvalkhof">twitter</a> and we can go for a coffee or something :)</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/life/in-barcelona/">In Barcelona!</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=UOQa4J"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=UOQa4J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=MLv83j"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=MLv83j" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=dOcATj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=dOcATj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=bENdnJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=bENdnJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=YKdinj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=YKdinj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=UfjQ6J"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=UfjQ6J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=Ggsx4J"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=Ggsx4J" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/life/in-barcelona/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/life/in-barcelona/</feedburner:origLink></item>
		<item>
		<title>Random CSS Thought: Margin-collape CSS property</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/329360759/</link>
		<comments>http://kilianvalkhof.com/2008/css-xhtml/random-css-thought-margin-collape-css-property/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 01:00:20 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[CSS &amp; (X)HTML]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=75</guid>
		<description><![CDATA[I was recently introduced to the phenomenon of margin collapsing. If you didn&#8217;t click the link, this is what it does: When you have two elements with a bottom and a top margin under each other, the margins will collapse into each other, so that the larger of the two becomes the margin between them.
Delving [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently introduced to the phenomenon of <a href="http://reference.sitepoint.com/css/collapsingmargins">margin collapsing</a>. If you didn&#8217;t click the link, this is what it does: When you have two elements with a bottom and a top margin under each other, the margins will collapse into each other, so that the larger of the two becomes the margin between them.<span id="more-75"></span></p>
<h2>Delving into it</h2>
<p>There are some more advanced rules attached to this:</p>
<ul>
<li>It only happens on elements in <a href="http://kilianvalkhof.com/2008/css-xhtml/understanding-css-positioning-part-1/">normal flow</a> under each other.</li>
<li>It never happens on horizontal margins</li>
<li>It doesn&#8217;t happen on elements with a padding or a border between them</li>
<li></li>
<li>It doesn&#8217;t happen on elements with position:relative; or position:absolute</li>
<li>It doesn&#8217;t happen with floated or cleared elements</li>
</ul>
<p>That&#8217;s quite a list of exceptions, isn&#8217;t it? I always use either a top or a bottom margin, never both, so I wasn&#8217;t aware of the phenomenon until <a href="http://wnas.nl">Wilfred Nas</a> introduced me to it. It happens according to <a href="http://www.w3.org/TR/CSS2/box.html#collapsing-margins">specification</a>, but when you don&#8217;t expect it, it&#8217;s quite annoying.</p>
<p>There are plenty of use cases to imagine where you want to be able to control the collapsing of the margins, the biggest one being adjacent floats. Floats are often used to display a large number of blocks next and under each other. As we&#8217;ve seen in the above list, margin-collapse doesn&#8217;t work with horizontal margins <em>or</em> with floats, even though it would be incredibly useful, with developers now using negative margins on parent elements and other wierd tricks to get their layouts right.</p>
<p>Another use case would just be when you have positioned elements and still want margin-collapse on those elements.</p>
<h2>Margin-collapse:collapse;</h2>
<p>in CSS3 we can pick which <code>border-model</code> we want to use. In CSS2 we already have <code>border-collapse</code>. Why not allow front-end developers to control the margin collapsing as well? Just add a <code>margin-collapse</code> property with values similar to <code>border-collapse</code>: <code>collapse</code>, <code>separate</code> and <code>inherit</code>. perhaps you even want to add <code>margin-collapse-y</code> and <code>margin-collapse-x</code>, but that might be overkill.</p>
<p>Either way, I think it would be a useful addition to CSS and it sounds like a better option to give developers the choice than to spec it in one particular way. <strong>What do you think?</strong></p>
<p>I write about useful ideas for CSS more regularly, under the title <a href="http://kilianvalkhof.com/?s=random+css+thought">Random CSS Thought</a>. Feel free to check them out :)</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/css-xhtml/random-css-thought-margin-collape-css-property/">Random CSS Thought: Margin-collape CSS property</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=wIZ2tJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=wIZ2tJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=CH79Cj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=CH79Cj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=nBZgsj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=nBZgsj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=7Uv1TJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=7Uv1TJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=j8Pnaj"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=j8Pnaj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=Oi2NbJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=Oi2NbJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=KhABsJ"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=KhABsJ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/css-xhtml/random-css-thought-margin-collape-css-property/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/css-xhtml/random-css-thought-margin-collape-css-property/</feedburner:origLink></item>
		<item>
		<title>The great divide</title>
		<link>http://feeds.feedburner.com/~r/Kilianvalkhofcom/~3/322884001/</link>
		<comments>http://kilianvalkhof.com/2008/web/the-great-divide/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 01:00:23 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=74</guid>
		<description><![CDATA[A long time ago, there raged a war. At the time I was too young to notice much of it, but there were a great number of casualties. While the two major forced kept making new rules, the innocent inhabitants were forced to pick a side and fight along.
I am, obviously, talking about the Browser [...]]]></description>
			<content:encoded><![CDATA[<p>A long time ago, there raged a war. At the time I was too young to notice much of it, but there were a great number of casualties. While the two major forced kept making new rules, the innocent inhabitants were forced to pick a side and fight along.<span id="more-74"></span></p>
<p>I am, <em>obviously</em>, talking about the Browser Wars of lore, between Internet Explorer and Netscape. At the time, both browsers were rapidly innovating and adding new features, &mdash; however, they both implemented different stuff, never the same thing in the same way. This caused web developers to develop for one of the two, two different sites for two browsers, or one sub-standard website that worked in both.</p>
<h2>Luckily, This is all over now</h2>
<p>Now, with increasing standards based browsers, this should be a thing of the past, right? <em>wrong!</em> </p>
<p>While we&#8217;re all piling over the new stuff the Big Four, Safari, Opera and Firefox (and, IE8, I &#8217;spose. At least, some people. I think&#8230;) come up with, both in own ideas and in standards support, there is an increasingly divergent pattern visible.</p>
<p>It seems that with every new nightly build, Safari (Webkit) adds a <a href="http://webkit.org/blog/138/css-animation/">mindblowing</a> <a href="http://webkit.org/blog/181/css-masks/">new</a> <a href="http://webkit.org/blog/130/css-transforms/">feature</a> that&#8217;s still lacking documentation but oh my, it&#8217;s <a href="http://webkit.org/blog/182/css-reflections/">shiny</a> and <a href="http://disruptive-innovations.com/zoo/cssvariables/">f-ing</a> <a href="http://webkit.org/blog/124/downloadable-fonts/">cool</a>. </p>
<p>Opera, on the other hand, is hard on it&#8217;s way to be the first <a href="http://dev.opera.com/articles/view/opera-9-5-the-next-generation-of-web-s/#html5">HTML5</a>, <a href="http://dev.opera.com/articles/view/opera-9-5-the-next-generation-of-web-s/#css3">CSS3</a> <a href="http://dev.opera.com/articles/view/opera-9-5-the-next-generation-of-web-s/">conforming browser</a>. Oh, and for good measure, they added in pretty much every other standards: (X)HTML, XML, XSLT, CSS 2.1, SVG 1.1 and JavaScript.</p>
<p>Firefox is, well, playing <a href="http://www.css3.info/firefox-developers-accelerate-css-implementation/">catch-up</a> with the above two, adding a bit of the idea&#8217;s from <a href="http://www.broken-links.com/2008/06/15/new-features-in-firefox-31-and-beyond/">safari, opera</a> or, if you&#8217;re lucky, both. To be honest, it&#8217;s also making great headway on SVG.</p>
<p>And IE isn&#8217;t even trying, adding their own <a href="http://go.microsoft.com/fwlink?LinkID=110264">non-conforming microformats</a> and just getting round to <a href=http://go.microsoft.com/fwlink?LinkID=110266" >CSS2.1</a>. well, whoop-dee-doo! Now go to bed and stay there, this is grown-up time. </p>
<h2>What do you want to be?</h2>
<p>Opera is heading towards ultra-super-duper standards support. Safari wants to take over the desktop. Firefox wants to integrate the desktop and the web. Internet explorer&hellip; just wants to play with the big kids.</p>
<p>But because of these goals (as they are perceived by me, anyway) all the browsers have different priorities in what features they support. This makes business sense, but it&#8217;s incredibly frustrating for developers. Web standards are of course supposed to be the baseline here, but in reality they are not, and standards-based feature support is just as diverse as home-grown innovations.</p>
<h2>What can we do</h2>
<p>The way I see it, for developers, there are a couple of options:</p>
<ul>
<li>We can stick with HTML4 and CSS2.1 for the foreseeable time, they&#8217;ve solid support nowadays</li>
<li>We learn every feature of every browser and serve (slightly) different pages to each</li>
<li>we give up and all start using plaintext.</li>
</ul>
<p>Obviously the latter isn&#8217;t going to happen, but the first two look suspiciously like the choice the martyrs in the Browser Wars had to make. Only instead of <em>two</em> browsers, we now have <em>four</em> to support. (Being extremely positive and forgetting about IE6 and IE7)</p>
<h2>This is not a choice we should make</h2>
<p>I&#8217;m all right with different browsers having different goals, and them needing different features for it. However, <strong>we thought up standards for a reason</strong>. The reason being interoperability. </p>
<p>What I think needs to happen, is an even larger degree of openness concerning features. Not business goals, just features. <strong>With 50% of the Big Four being open source, this shouldn&#8217;t be hard.</strong> Both Webkit and Firefox already have a lot of documentation, and Opera, despite being closed-source, offers a tremendous amount of documentation as well. (<em>Notice who&#8217;s missing&hellip;</em>) </p>
<h2>All I&#8217;m asking for&hellip;</h2>
<p>&hellip;Is a single document, outlining the baseline support in the browsers for the coming years (increasing the baseline each year), agreed upon by the Big Four. That&#8217;s is all that&#8217;s needed to help mature the web in a developer and user-friendly way and will still allow each individual browser to focus on it&#8217;s business goals.</p>
<p>a</p>
<p><a href="http://kilianvalkhof.com/2008/web/the-great-divide/">The great divide</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=aAoBNI"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=aAoBNI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=2qtp5i"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=2qtp5i" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=JDWGIi"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=JDWGIi" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=sLjrbI"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=sLjrbI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=WAnYSi"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=WAnYSi" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=BDdx3I"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=BDdx3I" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Kilianvalkhofcom?a=Y0cgAI"><img src="http://feeds.feedburner.com/~f/Kilianvalkhofcom?i=Y0cgAI" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2008/web/the-great-divide/feed/</wfw:commentRss>
		<feedburner:origLink>http://kilianvalkhof.com/2008/web/the-great-divide/</feedburner:origLink></item>
	<feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetFeedData?uri=Kilianvalkhofcom</feedburner:awareness></channel>
</rss><!-- Dynamic Page Served (once) in 0.373 seconds -->
