<?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>CodeDread Blog &#187; CSS</title>
	<atom:link href="http://www.codedread.com/blog/archives/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codedread.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 02 Jan 2012 15:30:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Oh The Things You&#8217;ll Learn</title>
		<link>http://www.codedread.com/blog/archives/2009/06/27/oh-the-things-youll-learn/</link>
		<comments>http://www.codedread.com/blog/archives/2009/06/27/oh-the-things-youll-learn/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 14:35:25 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://blog.codedread.com/archives/2009/06/27/oh-the-things-youll-learn/</guid>
		<description><![CDATA[I was playing around with a new project recently and wanted to figure out the complementary color of a given color. All you need for this are the RGB values of the color for which you want to find the complement. There are lots of ways of specifying a color on the Open Web: rgb(255,0,0) [...]]]></description>
			<content:encoded><![CDATA[<p><object type="image/svg+xml" width="100" height="100" style="float:right" data="http://codedread.com/clipart/html.svgz"><span/></object>I was playing around with a <a href="http://jgraduate.googlecode.com/">new project</a> recently and wanted to figure out the <a href="http://en.wikipedia.org/wiki/Complementary_color">complementary color</a> of a given color.  All you need for this are the RGB values of the color for which you want to find the complement.</p>
<p>There are lots of ways of specifying a color on the Open Web:</p>
<ul>
<li>rgb(255,0,0)</li>
<li>rgb(100%,0,0)</li>
<li>#FF0000</li>
<li>#F00</li>
<li>&#8220;red&#8221;</li>
</ul>
<p>And it&#8217;s not just the <a href="http://www.w3.org/TR/CSS2/syndata.html#color-units">17 CSS color names</a>, there are 147 cool-sounding extended color names like <a href="http://www.w3.org/TR/SVG/types.html#ColorKeywords">papayawhip</a>.  So given that a user can input a color in all sorts of ways, what&#8217;s the right way to do this? <span id="more-539"></span></p>
<h3>The Hard Way</h3>
<p>You can build a parser that determines the color format, parses hex and rgb strings and has a table that maps 147 strings to rgb triplets.  It turns out there are a lot of JavaScript libraries that already do this.  <a href="http://code.google.com/p/jquery-color-utils/">Here&#8217;s one</a>.</p>
<p>But then I thought:  why am I including yet another JavaScript library to do this parsing when the browser must already know how to map from hex, rgb or color name to an RGB triplet (or equivalent) in order to render the color in the first place?  Surely there&#8217;s a way to extract this directly out of the DOM?</p>
<h3>The DOM Way</h3>
<p>It turns out there is.  It&#8217;s called the <a href="http://www.w3.org/TR/DOM-Level-2-Style/Overview.html">CSS DOM</a> and I always seem to forget about this document.  Piecing together information from the <a href="http://www.w3.org/TR/SVG11/types.html#InterfaceSVGStylable">SVG</a> <a href="http://www.w3.org/TR/SVG11/types.html#InterfaceSVGColor">DOM</a> and the <a href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-RGBColor">CSS</a> <a href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSPrimitiveValue">DOM</a>, this is how you would get the red value of a fill attribute on a circle:</p>
<p><code>var red = someCircle.getPresentationAttribute("fill").rgbColor.red.getFloatValue(1);</code></p>
<p>That&#8217;s just a bit perverse, but at least it&#8217;s possible.</p>
<p>In testing this I was delighted to discover that Opera and WebKit let me do it.  Sadly, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=500888">Firefox does not</a>.</p>
<h3>The Best-Laid Plans&#8230;</h3>
<p><object type="image/svg+xml" width="100" height="100" style="float:right" data="http://codedread.com/clipart/facepalm.svgz"><span/></object>Here&#8217;s where the plot thickens.  Seems like the CSS Working Group was chartered to produce a new version of the CSS DOM to make the interfaces less clunky.  Seems like the CSS WG sent out a notice <a href="http://lists.w3.org/Archives/Public/www-style/2003Oct/0347.html">strongly warning browsers</a> not to implement certain DOM interfaces in the CSS DOM.  Seems like it&#8217;s six years later and there&#8217;s no new document.</p>
<p>Unfortunately this is where my sad little tale ends.  <a href="http://twitter.com/erikdahlstrom/status/2357983806">Erik of Opera</a> suggests that the SVGT 1.2 uDOM is really the right way to do this.  It doesn&#8217;t matter that I agree with him because I don&#8217;t think Webkit or Mozilla have any interest in implementing this any time soon.</p>
<p>It seems kind of sad that folks have to write JavaScript libraries to do color parsing when the browsers already do this natively.  It also seems really weird that the SVG DOM interfaces extend obsolete CSS DOM interfaces (SVGColor extends CSSValue which Bert Bos mentions in his email).</p>
<p>#DOMFAIL ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codedread.com/blog/archives/2009/06/27/oh-the-things-youll-learn/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>CSS Naked Day 2009</title>
		<link>http://www.codedread.com/blog/archives/2009/04/09/css-naked-day-2009/</link>
		<comments>http://www.codedread.com/blog/archives/2009/04/09/css-naked-day-2009/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 11:53:26 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[naked day]]></category>

		<guid isPermaLink="false">http://blog.codedread.com/archives/2009/04/09/css-naked-day-2009/</guid>
		<description><![CDATA[Do not adjust your sets, today is CSS Naked Day. I decided to steal Sam Ruby&#8217;s &#8220;naked trucker silhouette&#8221; this year. Sam has privately let me know that I cheat by using inline style, but sometimes I want to float my clipart left and sometimes I want to float it right. I guess I should [...]]]></description>
			<content:encoded><![CDATA[<p><object type="image/svg+xml" width="100" height="100" style="float:right" data="http://codedread.com/clipart/naked.svgz"><span/></object>Do not adjust your sets, today is <a href="http://naked.dustindiaz.com/">CSS Naked Day</a>.  I decided to steal Sam Ruby&#8217;s &#8220;naked trucker silhouette&#8221; this year.  Sam has privately let me know that I cheat by using inline style, but sometimes I want to float my clipart left and sometimes I want to float it right.  I guess I should turn those into classes.  Will do so for next year.  Oh well, <a href="http://intertwingly.net/blog/2008/04/09/CSS-Naked-Day">Sam cheats too</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codedread.com/blog/archives/2009/04/09/css-naked-day-2009/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apple&#8217;s Web Inventions</title>
		<link>http://www.codedread.com/blog/archives/2008/04/25/apples-web-inventions/</link>
		<comments>http://www.codedread.com/blog/archives/2008/04/25/apples-web-inventions/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 01:43:32 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://blog.codedread.com/archives/2008/04/25/apples-web-inventions/</guid>
		<description><![CDATA[The last two years have been explosive for WebKit development &#8211; the project has really accelerated, moving at a much faster perceivable rate than the other notable open-source web platform, Mozilla. I&#8217;ve been noticing more and more innovations that affect web developers from the Safari blog. 2008-04-29 &#8211; CSS Reflections 2008-04-24 &#8211; CSS Masks 2008-04-17 [...]]]></description>
			<content:encoded><![CDATA[<p><object type="image/svg+xml" width="100" height="100" align="right" hspace="10" data="http://codedread.com/clipart/apple.svgz"><span/></object>The last two years have been explosive for <a href="http://webkit.org/">WebKit</a> development &#8211; the project has really accelerated, moving at a much faster perceivable rate than the other notable open-source web platform, <a href="http://mozilla.org/">Mozilla</a>.  I&#8217;ve been noticing more and more innovations that affect web developers from <a href="http://webkit.org/blog/" title="Surfin' Safari weblog">the Safari blog</a>.  <span id="more-453"></span></p>
<ul>
<li><ins>2008-04-29 &#8211; <a href="http://webkit.org/blog/182/css-reflections/">CSS Reflections</a></ins></li>
<li>2008-04-24 &#8211; <a href="http://webkit.org/blog/181/css-masks/">CSS Masks</a></li>
<li>2008-04-17 &#8211; <a href="http://webkit.org/blog/176/css-canvas-drawing/">CSS Canvas Drawing</a></li>
<li>2008-04-14 &#8211; <a href="http://webkit.org/blog/175/introducing-css-gradients/">CSS Gradients</a></li>
<li><ins>2008-04-08? &#8211; <a href="http://webkit.org/specs/CSSVisualEffects/CSSTransitions.html">CSS Transitions</a></ins></li>
<li>2007-10-31 &#8211; <a href="http://webkit.org/blog/138/css-animation/">CSS Animation</a> <ins>(<a href="http://webkit.org/specs/CSSVisualEffects/CSSAnimation.html">spec proposal</a>)</ins></li>
<li>2007-10-26 &#8211; <a href="http://webkit.org/blog/130/css-transforms/">CSS Transforms</a> <ins>(<a href="http://webkit.org/specs/CSSVisualEffects/CSSTransforms.html">spec proposal</a>)</ins></li>
<li>2006-12-21 &#8211; <a href="http://webkit.org/blog/85/introducing-text-stroke/">Text Fill and Stroke</a></li>
<li>2004? &#8211; <a href="http://www.whatwg.org/specs/web-apps/current-work/#the-canvas">HTML Canvas</a> &#8211; thankfully this was quickly reviewed and thrown into HTML5 so that Opera and Mozilla could get into the act</li>
<li><a href="http://developer.apple.com/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html">Others</a> -webkit-border-horizontal-spacing, -webkit-border-vertical-spacing, -webkit-margin-bottom-collapse, -webkit-margin-collapse, -webkit-margin-start, -webkit-margin-top-collapse, -webkit-padding-start, background-position-x, background-position-y, -webkit-tap-highlight-color (iPhone only), -webkit-text-security, -webkit-text-size-adjust (iPhone only), -webkit-line-break, -webkit-nbsp-mode, -webkit-rtl-ordering, -webkit-user-drag, -webkit-user-modify, -webkit-user-select, -webkit-dashboard-region (Dashboard only)</li>
</ul>
<h3 id="is-this-a-problem"><a href="#is-this-a-problem">Is this a problem?</a></h3>
<p><object type="image/svg+xml" width="100" height="100" align="right" hspace="10" data="http://codedread.com/clipart/svg.svgz"><span/></object>What&#8217;s troubling me is not that many of these inventions could have been done using <a href="http://www.w3.org/Graphics/SVG" title="Scalable Vector Graphics">SVG</a> (which WebKit now supports quite nicely).  I understand that <abbr title="eXtensible Markup Language">XML</abbr> is not for everyone and that a few <abbr title="Cascading Style Sheets">CSS</abbr> properties are easier to pick up to do what you want.</p>
<p>No, what troubles me is that <ins>a few of</ins> these innovations are not yet proposed as formal specifications so that they can be interoperably implemented in other browsers (Firefox, Opera).  <strong>[Update:  Correction - as <a href="http://blog.codedread.com/archives/2008/04/25/apples-web-inventions/#comment-12535">Mark points out</a> below, several of these <em>have</em> indeed been proposed as formal specifications - Bravo!]</strong>  <del>The point of the WHATWG effort was both to evolve HTML and to specify it in sufficient detail so that future browser vendors would not have to reverse engineer de facto browser behavior.  Will the WHATWG eventually have to churn out CSS5?!? <img src='http://www.codedread.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </del></p>
<h3 id="on-the-other-hand"><a href="#on-the-other-hand">On the other hand&#8230;</a></h3>
<p><object type="image/svg+xml" width="100" height="100" align="right" hspace="10" data="http://codedread.com/clipart/tools.svgz"><span/></object>&#8230; Apple has a perfect right to introduce WebKit-specific CSS properties.  WebKit is more than just a single web browser.  WebKit is a <em>platform</em> and Apple obviously wants to put as many cool web development tools into the hands of its developers as possible.  They&#8217;re already doing a good job at meeting existing open web standards &#8211; why not innovate on the side?  Also, using CSS ensures that things can degrade gracefully, so you can&#8217;t quite fault Apple for &#8216;anti-competitve behavior&#8217; like you could Microsoft and Netscape&#8217;s efforts during <a href="http://en.wikipedia.org/wiki/Browser_war#The_first_browser_war">the First Browser War</a>.</p>
<h3 id="unfortunately"><a href="#unfortunately">Unfortunately&#8230;</a></h3>
<p>Unfortunately these inventions might have the same secondary effect:  Forcing the other browser vendors to spend resources on <em>reverse-engineering</em> efforts in order to remain competitive.  This could realistically happen before Apple gets a chance to <a href="http://webkit.org/blog/181/css-masks/#comment-24401" title="Dave Hyatt states that these innovations will be proposed to the W3C eventually">propose these things</a> formally to the <abbr title="World Wide Web Consortium">W3C</abbr>.  <strong>[Update: See <a href="http://blog.codedread.com/archives/2008/04/25/apples-web-inventions/#comment-12535">Mark's comment</a> below]</strong>.  It is much more likely to happen if WebKit were to become the dominant force on the open web.</p>
<p>WebKit is not yet the dominant web browser technology, but it&#8217;s fast on the rise.  From all accounts, it is much easier to pick up and hack on than the Mozilla codebase.  Let&#8217;s take a look at where it is being used:</p>
<ul>
<li>MacOS Dashboard</li>
<li>Safari on MacOS</li>
<li>Safari on iPhone</li>
<li>Google&#8217;s Android</li>
<li>Adobe&#8217;s Integrated Runtime (AIR)</li>
<li>Qt 4.4+</li>
<li>Nokia S60 Browser</li>
</ul>
<p>I&#8217;m sure readers can help me add to the above list too.  I believe there is a plan for WebKit to ultimately take over Konqueror&#8217;s KHTML guts one day too, isn&#8217;t there?  Ironic since WebKit evolved from KHTML in the first place.</p>
<h3 id="so-when-will-it-be-a-problem"><a href="#so-when-will-it-be-a-problem">So when will it be a problem?</a></h3>
<p>Are we seeing any signs of a trend towards a WebKit-dominated web yet?  There are already <a href="http://www.tuaw.com/2007/07/18/the-strange-case-of-made-for-iphone-websites/">iPhone-specific websites</a>.  How long before Opera Mobile and Mozilla Minimo want to get in on that action and are forced to reverse-engineer?  And I&#8217;m sorry, but <a href="http://ajaxian.com/archives/css-gradients-in-webkit#comment-262861" title="Trevor suggests that all browser vendors have to do is look at the WebKit source to figure out how a feature was implemented">looking at the source</a> is not an acceptable alternative to a well-defined specification.</p>
<h3 id="conclusion"><a href="#conclusion">A tentative conclusion</a></h3>
<p>After typing up this entry and proof-reading it, I tried to discern if I had any coherent conclusion and if I could figure out just what the heck I was saying:</p>
<ul>
<li>Apple is not in the wrong for introducing WebKit-specific CSS properties, I think they <a href="http://ln.hixie.ch/?start=1089635050&#038;count=1">learned their lesson</a> from the HTML Canvas experience.</li>
<li>You also cannot fault Apple for its adherence to web standards.  They are definitely doing their job here</li>
<li>It seems like they <a href="http://webkit.org/blog/181/css-masks/#comment-24401">plan to propose these things</a> as standards eventually, which is also a good thing.</li>
<li>I guess the only thing I can say is that I hope these proposals happen sooner rather than later, for the other browsers&#8217; sake.  <strong>[Update: As mentioned below, Apple has <em>already</em> proposed many of these things to the W3C as specifications, thereby alleviating most of my concern]</strong>.  Apple should take a page from what happened to DOM Events:  The fact that Netscape and Microsoft had two different event models resulted in the W3C proposing yet a <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html">third incompatible Event Model</a>, which Microsoft <em>still</em> has not implemented <em>eight years later</em>.  Those type of things just hurt web developers in the end.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.codedread.com/blog/archives/2008/04/25/apples-web-inventions/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CSS Naked Day Again &#8211; Not!</title>
		<link>http://www.codedread.com/blog/archives/2008/04/05/css-naked-day-again-not/</link>
		<comments>http://www.codedread.com/blog/archives/2008/04/05/css-naked-day-again-not/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 18:47:24 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://blog.codedread.com/archives/2008/04/05/css-naked-day-again/</guid>
		<description><![CDATA[If you&#8217;re wondering what happened to my pretty site earlier today, no it was not some malicious XHTML prank, it was my premature support for CSS Naked Day. Dustin changed it to April 9th this year &#8211; that&#8217;s rather silly considering the PHP function is supposed to do the work for us. I suspect lots [...]]]></description>
			<content:encoded><![CDATA[<p><object type="image/svg+xml" width="100" height="100" align="right" hspace="10" data="http://codedread.com/clipart/php.svgz"><span/></object>If you&#8217;re wondering what happened to my pretty site earlier today, no it was not some malicious XHTML prank, it was my premature support for <a href="http://naked.dustindiaz.com/">CSS Naked Day</a>.  Dustin changed it to April 9th this year &#8211; that&#8217;s rather silly considering the PHP function is supposed to do the work for us.  I suspect lots of sites will be going naked today inadvertently.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codedread.com/blog/archives/2008/04/05/css-naked-day-again-not/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

