<?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>ReDsgn &#187; Semantic</title>
	<atom:link href="http://www.redsgn.com/tag/semantic/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redsgn.com</link>
	<description>When small things come together great things happen.</description>
	<lastBuildDate>Tue, 10 Nov 2009 04:15:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Semantic Rounded Corners</title>
		<link>http://www.redsgn.com/2008/11/24/semantic-rounded-corners/</link>
		<comments>http://www.redsgn.com/2008/11/24/semantic-rounded-corners/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 16:35:25 +0000</pubDate>
		<dc:creator>Paul Boutin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[Rounded Corners]]></category>
		<category><![CDATA[Semantic]]></category>
		<category><![CDATA[Sliding Doors]]></category>
		<category><![CDATA[Styling Headers]]></category>

		<guid isPermaLink="false">http://www.redsgn.com/?p=127</guid>
		<description><![CDATA[In today&#8217;s modern web design Rounded corners are the new trend. So in keeping up with the trend we need to accommodate new designs with our current markup. In this post I will show you how to take any four containers of markup and convert them into a semantic rounded corner display. This technique will [...]]]></description>
			<content:encoded><![CDATA[<p>In today&#8217;s modern web design Rounded corners are the new trend. So in keeping up with the trend we need to accommodate new designs with our current markup. In this post I will show you how to take any four containers of markup and convert them into a semantic rounded corner display. This technique will be fluid and accommodate text size changes. (Tested in IE 6 and 7 and Firefox 3) If this works in other browsers please let me know.</p>
<p>This technique uses the <a href="http://www.alistapart.com/articles/slidingdoors/">Sliding Doors of CSS</a> technique described by <a href="http://www.alistapart.com/authors/b/douglasbowman">Douglas Bowman</a> on <a href="http://www.alistapart.com/">A List Apart</a>.</p>
<p>We need 4 containers or elements we can apply style to, to define the four corners we want to round. Here you see I&#8217;m using an h4 tag as my outer container and nesting inside it two spans one for the header text and one for a link or anchor point. With the inclusion of our anchor tag we now have our four elements.</p>
<p><code>&lt;h4&gt;&lt;span class="title"&gt;H4 Demo Title 2&lt;/span&gt;&lt;span class="link"&gt;&lt;a href="edit_link.htm" title="edit"&gt;Edit&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;<br />
</code></p>
<p><code>&lt;h4&gt;&lt;span class="title"&gt;H4 Demo Title&lt;/span&gt;&lt;span class="link"&gt;&lt;a name="anchor"&gt;&amp;nbsp;&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;<br />
</code></p>
<p>The markup may seem a bit overkill in this example but I tend to always design for the future. In my original markup I wanted to allow for Graphic headers as well as edit links in my headers. But as you can see in my second example the edit link can be used as a legacy anchor. No matter how you split it up the goal here is to have semantic markup in the end not a bunch of meaningless wrapper divs. I will get into using wrapper containers in a later post.</p>
<p><span id="more-127"></span></p>
<p>I have created my corners in a graphical editor. I used gif&#8217;s for their transparency and browser support. The corners are transparent on the inside of the corner and have the background color of the page on the outside of the corner. Doing this allows me to style the background of the object that is being rounded with any color and not have to recreate the corner images every time I want to change the styling. Here are the images as I have made them. 
<a href='http://www.redsgn.com/2008/11/24/semantic-rounded-corners/corner-bl/' title='corner-bl'><img width="4" height="4" src="http://www.redsgn.com/wp-content/uploads/2008/11/corner-bl.gif" class="attachment-thumbnail" alt="Bottom Left Corner" title="corner-bl" /></a>
<a href='http://www.redsgn.com/2008/11/24/semantic-rounded-corners/corner-tr/' title='corner-tr'><img width="4" height="4" src="http://www.redsgn.com/wp-content/uploads/2008/11/corner-tr.gif" class="attachment-thumbnail" alt="Top Right Corner" title="corner-tr" /></a>
<a href='http://www.redsgn.com/2008/11/24/semantic-rounded-corners/corner-br/' title='corner-br'><img width="4" height="4" src="http://www.redsgn.com/wp-content/uploads/2008/11/corner-br.gif" class="attachment-thumbnail" alt="Bottom Right Corner" title="corner-br" /></a>
<a href='http://www.redsgn.com/2008/11/24/semantic-rounded-corners/corner-tl/' title='corner-tl'><img width="4" height="4" src="http://www.redsgn.com/wp-content/uploads/2008/11/corner-tl.gif" class="attachment-thumbnail" alt="Top Left Corner" title="corner-tl" /></a>
</p>
<p>Ok so now lets style it&#8230;</p>
<p><code>h4 {<br />
background:#E3E3E3 url(corner-TL.gif) no-repeat scroll 0 0;<br />
font-size:1.1em;<br />
height:5ex;<br />
position:relative;<br />
}<br />
</code></p>
<p>I set the background color on the outer container and position the background (in this case the Top Left corner,) image to the top left and set it to no repeat. I set the position to relative so I can use absolute positioning for the rest of the corners. I also set the height here to accommodate the text so I used ex which is 1/2 em in browser calculations. see my post on <a href="http://www.redsgn.com/2008/11/15/calculating-ems/">calculating ems</a> for more info. (Note: Elements when positioned absolute are removed from the document flow causing the parent containers to collapse as if they have no contents.)</p>
<p><code>h4 span.title {<br />
background:transparent url(corner-BL.gif) no-repeat scroll 0 100%;<br />
bottom:0;<br />
display:block;<br />
left:0;<br />
padding:0 0 10px 10px;<br />
position:absolute;<br />
}<br />
</code></p>
<p>Here I set the Bottom left corner position in the background property and set the position to absolute with a bottom and left of zero. Its important to note that our background color is set to transparent here because all of the absolute positioned elements inside the first container sit on top and I don&#8217;t want to hide the background image of its container element. The padding is set to space in my text 10px from the left and bottom of the container. I set the display to block and any inline element so it holds its padding.</p>
<p><code>h4 span.link {<br />
background:transparent url(corner-TR.gif) no-repeat scroll 100% 0;<br />
display:block;<br />
height:5ex;<br />
padding:0 10px;<br />
position:absolute;<br />
right:0;<br />
top:0;<br />
}<br />
</code></p>
<p>Here I set the top Right corner nothing different and pad in the text 10px. I set the height to the same height we used for the container. Since this container has no content (child elements when positioned absolute are removed from the document flow causing the parent containers to collapse) we set the padding to accommodate the corner image and the height to accommodate the anchor tag.</p>
<p><code>h4 span.link a {<br />
background:transparent url(corner-BR.gif) no-repeat scroll 100% 100%;<br />
bottom:0;<br />
display:block;<br />
font-size:0.7em;<br />
font-weight:normal;<br />
padding:0 10px 10px 0;<br />
position:absolute;<br />
right:0;<br />
}<br />
</code></p>
<p>In this last piece we set the Bottom Right corner and pad in the text from the right and bottom. I reduced the font size for the link so it does not compete with the header text. Set the padding here to 10px to accommodate the corner image and spacing in the text from the bottom and right.</p>
<h4>The Results</h4>
<h4 class="titlebar"><span class="title">H4 Demo Title 1</span><span class="link"><a href="#" title="edit">Edit</a></span></h4>
<h4 class="titlebar"><span class="title">H4 Demo Title 2</span><span class="link"><a name="demo2" id="demo2">&nbsp;</a></span></h4>
]]></content:encoded>
			<wfw:commentRss>http://www.redsgn.com/2008/11/24/semantic-rounded-corners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
