<?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>greenideas &#187; standards</title>
	<atom:link href="http://mwhenry.com/blog/tag/standards/feed/" rel="self" type="application/rss+xml" />
	<link>http://mwhenry.com/blog</link>
	<description>A blog by Matt Henry</description>
	<lastBuildDate>Fri, 02 Jul 2010 23:26:44 +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>The Rounded Corners of Tomorrow… Today!</title>
		<link>http://mwhenry.com/blog/2008/10/the-rounded-corners-of-tomorrow-today/</link>
		<comments>http://mwhenry.com/blog/2008/10/the-rounded-corners-of-tomorrow-today/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 04:46:12 +0000</pubDate>
		<dc:creator>Matt Henry</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://mwhenry.com/?p=19</guid>
		<description><![CDATA[Hey, you know what can be a real pain in the tail? CSS rounded corners. Of course there are battle-tested, workhorse solutions out there, like sliding doors, or a handful of Javascript-based alternatives. But rounded corners are such a common element of web design and seem like a natural extension of the designer’s existing toolkit [...]]]></description>
			<content:encoded><![CDATA[<p>Hey, you know what can be a real pain in the tail? CSS rounded corners. Of course there are battle-tested, workhorse solutions out there, like <a href="http://www.alistapart.com/articles/slidingdoors/">sliding doors</a>, or a handful of <a href="http://www.curvycorners.net/">Javascript-based</a> alternatives. But rounded corners are such a common element of web design and seem like a natural extension of the designer’s existing toolkit that it only makes sense that there should be a way to implement them with pure CSS. The good news is that <code>border-radius</code> is indeed <a href="http://www.w3.org/TR/css3-background/#border-radius">coming in CSS3</a>. The better news is that you can start using it today, as long as you’re only targeting Gecko &amp; Webkit. Before we get to that though, let’s look at the way it’s supposed to work according to the spec.</p>
<p>As you might expect, the <code>border-radius</code> property is used a lot like <code>border</code>. That is, you can specify one value for each corner (<code>border-radius: 10px;</code>), one value per corner (<code>border-radius: 1px 2px 3px 4px;</code>), or values for opposite corners (<code>border-radius: 5px 10px</code>). It actually gets more complicated, since in addition to describing corners with one radius (i.e. those with semi-circular curves), you can make elliptically rounded corners by naming two radii. For more detail on this, take a look at the draft spec. Lastly, you can use a property for each corner, <code>border-top-left-radius: 2em;</code>, etc. So, assuming there aren’t any major changes in the spec, expect this to be what gets implemented as part of CSS3, and what you’ll ultimately using in your code.</p>
<p>But what about now? Here? Today? It happens that two of the standards-aware, forward-thinking rendering engines have developed proprietary extensions to CSS that should stand in for <code>border-radius</code> until certain <a href="http://www.css3.info/border-radius-apple-vs-mozilla/">ambiguities</a> in the spec can be resolved, and the property is implented according to the standard. So if you want to use <code>border-radius</code> in your code today, you’ll have to use both the Mozilla– and Webkit-specific CSS properties. Fortunately, both of the proprietary extensions work in the current major releases of their respective browsers.</p>
<p>If you’re making a box with four corners of the same radius, the syntax is the same in Mozilla and Webkit:</p>
<pre class="code">-moz-border-radius: 10px; /* 4 corners of radius = 4px*/
-webkit-border-radius: 10px; /* Same as Mozilla */</pre>
<p>To specify different radii for each corner, things diverge somewhat.</p>
<pre class="code">/* Mozilla: */
-moz-border-radius: 1px 2px 3px 4px;
/* Webkit:
    (The four declarations below amount to the
    same thing as the single rule above) */
-webkit-border-top-left-radius: 1px;
-webkit-border-top-right-radius: 2px;
-webkit-border-bottom-right-radius: 3px;
-webkit-border-bottom-left-radius: 4px;</pre>
<p>And that’s the guts of it. So to make a tabbed navigation list, you would use a declaration along the lines of the following (and <a href="examples/borderradius.html">see the below code in action.</a>):</p>
<pre class="code">li {
  border: 1px solid #587402;
  border-bottom: none;
  border-radius: 0 10px 0 10px;
  -moz-border-radius: 10px 10px 0 0;
  -webkit-border-top-left-radius: 10px;
  -webkit-border-top-right-radius: 10px;
  list-style-type: none;
  float: left;
  padding: .5em 1em 0 1em;
}</pre>
<p>There you have it. But there are just a couple of other things I want to point out. If the container you’re rounding the corners of has only text content and a background in it, the background will clip to the rounded corners. And indeed, according to the spec, <em>any</em> the contents of a block-level element on which a border-radius is set should clip do the same as long as you set <code>overflow: hidden</code> on those contents. However, the implementations just aren’t there yet. Instead, with anything over and above plain HTML text (for instance, an <code>img</code> or <code>iframe</code>) inside such a container, the square corners will peek outside of the rounded container. (<a href="examples/borderradius.html#pointy">Example</a>)</p>
<p>One solution would be to make the border thick enough that the corners of the inner element can’t poke through the outer border (<a href="examples/borderradius.html#bigBorder">like so</a>). Though inelegant, this will work just fine if you don’t need everything to round nicely. And this method should suffice for whatever kind of content you’re trying to stuff into your nicely rounded box.</p>
<p>However, if it’s an image you’re putting in the box and you need the inner corners to be rounded as well as the outer corners, then the only answer (for now) is to <a href="examples/borderradius.html#bigBorder">set the image as a background</a>. Still, if the language of the spec is any indication, it won’t always be this way.</p>
<p>For the poor soul who is trying to squeeze iframe content into a rounded corner box, you’re essentially out of luck at the moment. You can certainly use the thick border method I described above, but short of that, you’ll have to look to the bleeding edge. That is to say, you’ll need something which isn’t yet in any production-quality browser, but that is currently in the Webkit nightlies. I speak of the arcane methods of <code>-webkit-mask-image</code>. This property can take a png or an svg as its url, and pretty much anything you apply it to will play nice and clip to the shape of the image. <a href="examples/borderradius.html#map">See for yourself.</a> Still, this last bit is obviously not anything anybody will be using in production code for some time to come.</p>
<p>After reading all of this, if nothing else, I do hope that you’ve come away with a better idea of some of the great things that the CSS working group has in store for you, the developer. But even moreso, hopefully there’s something in all of this mess that you’ll be able to put to use today.</p>
]]></content:encoded>
			<wfw:commentRss>http://mwhenry.com/blog/2008/10/the-rounded-corners-of-tomorrow-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I’m Reading: 3/19</title>
		<link>http://mwhenry.com/blog/2008/03/what-im-reading-319/</link>
		<comments>http://mwhenry.com/blog/2008/03/what-im-reading-319/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 14:49:33 +0000</pubDate>
		<dc:creator>Matt Henry</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://mwhenry.com/?p=9</guid>
		<description><![CDATA[Martian Headsets: Spolsky’s take on IE8 &#38; web standards. Translation From MS-Speak to English of Selected Portions of Joel Spolsky’s “Martian Headsets”: Mark Pilgrim’s take on the above. SitePoint Guru Lists: SitePoint’s authors have listed the best articles on the SitePoint, er, site, for getting started in various areas of web design &#38; development.]]></description>
			<content:encoded><![CDATA[<ol>
<li><a href="http://www.joelonsoftware.com/items/2008/03/17.html">Martian Headsets</a>: Spolsky’s take on IE8 &amp; web standards.</li>
<li><a href="http://diveintomark.org/archives/2008/03/18/translation-from-ms-speak-to-english-of-selected-portions-of-joel-spolskys-martin-headsets">Translation From MS-Speak to English of Selected Portions of Joel Spolsky’s “Martian Headsets”</a>: Mark Pilgrim’s take on the above.</li>
<li><a href="http://www.sitepoint.com/gurulists/">SitePoint Guru Lists</a>: SitePoint’s authors have listed the best articles on the SitePoint, er, site, for getting started in various areas of web design &amp; development.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://mwhenry.com/blog/2008/03/what-im-reading-319/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
