<?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>pamgriffith.net &#187; CSS</title>
	<atom:link href="http://www.pamgriffith.net/blog/category/css/feed" rel="self" type="application/rss+xml" />
	<link>http://www.pamgriffith.net</link>
	<description></description>
	<lastBuildDate>Sun, 22 Aug 2010 06:45:41 +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>Stupid css tricks: line breaks in lists</title>
		<link>http://www.pamgriffith.net/blog/line-breaks-in-lists</link>
		<comments>http://www.pamgriffith.net/blog/line-breaks-in-lists#comments</comments>
		<pubDate>Wed, 19 May 2010 06:24:28 +0000</pubDate>
		<dc:creator>Pam Griffith</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.pamgriffith.net/?p=409</guid>
		<description><![CDATA[Periodically I encounter some problem with html and css layouts that could be solved by adding a few extra presentational tags to the html source (like &#60;br/&#62; or text bullets in the case I&#8217;m about to describe), but there&#8217;s no easy way to do it in CSS.  I almost always end up caving and doing [...]]]></description>
			<content:encoded><![CDATA[<p>Periodically I encounter some problem with html and css layouts that could be solved by adding a few extra presentational tags to the html source (like &lt;br/&gt; or text bullets in the case I&#8217;m about to describe), but there&#8217;s no easy way to do it in CSS.  I almost always end up caving and doing it that way, but I like <a title="HTML5, CSS3, and the Great CSS-Off" href="http://www.pamgriffith.net/blog/html5-css3-and-the-great-css-off">flailing around and trying new things</a> first before giving up.  I feel like sharing the most recent example because I&#8217;m almost proud of it, and in some circumstances it might actually be the right thing to do.</p>
<p>What I have is a list of links for a blog.  This is an excellent candidate for an unordered list, except that I want them presented like so:</p>
<p style="text-align: center;">one &#8211; two &#8211; three</p>
<p style="text-align: center;">four &#8211; five &#8211; six</p>
<p style="text-align: center;">seven &#8211; eight</p>
<p>The trick here is getting the dashes so they show up <strong>only in the middle of each line</strong>.  But there&#8217;s no easy way to tell where the natural line breaks are, so I cant just have the first &lt;li&gt; per line not have a dash in front of it.  That means I&#8217;m probably going to need to insert some line breaks so I know which ones are at the beginning of a line, but I&#8217;d still rather not do it in the html.</p>
<p>I ended up with this:</p>
<pre><code class="css">.blogroll { text-align: center; }
.blogroll li { display: inline; padding: 0 6px; }
.blogroll li + li:before { content: '-'; position: relative; left: -8px; }
.blogroll li:nth-child(3n+1):before { content: '\a'; position: static; white-space: pre; }</code></pre>
<p>The first two lines just make the elements centered, inline, and separated a bit.  The third line puts a dash before all&lt;li&gt; elements that come after another &lt;li&gt; element&#8211;effectively everything but the very first in the list.  The fourth one is the magic: it uses a new css selector <a href="http://reference.sitepoint.com/css/pseudoclass-nthchild">nth-child</a> to select <strong>the element after every third element</strong> (that&#8217;s the &#8220;3n+1&#8243; bit) and <strong>replaces the dash with a newline</strong> character (that&#8217;s the &#8220;\a&#8221; bit).  Normally newline characters are just converted to spaces, but setting the white-space to &#8220;pre&#8221; makes the line actually wrap there.</p>
<p>It almost works!  Unfortunately, there is a case it doesn&#8217;t handle well.  If one of the items is too long, the lines will wrap before the third item and you end up with this:</p>
<p style="text-align: center;">one &#8211; two  &#8211; three</p>
<p style="text-align: center;">four &#8211; reallyreallylong</p>
<p style="text-align: center;">- six</p>
<p style="text-align: center;">seven &#8211;  eight</p>
<p style="text-align: left;">Oh well.  I guess I&#8217;ll be putting those line breaks in by hand after all.  But if you don&#8217;t have to worry about that, it might actually be a good technique!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pamgriffith.net/blog/line-breaks-in-lists/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Complex uses of css3 box-shadow</title>
		<link>http://www.pamgriffith.net/blog/complex-uses-of-css3-box-shadow</link>
		<comments>http://www.pamgriffith.net/blog/complex-uses-of-css3-box-shadow#comments</comments>
		<pubDate>Sun, 11 Apr 2010 07:18:50 +0000</pubDate>
		<dc:creator>Pam Griffith</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.pamgriffith.net/?p=273</guid>
		<description><![CDATA[Sort of as a follow-up to the previous post on html5 and css3, I&#8217;ve been applying css3 to various situations to see how it does.  I&#8217;ve run across a couple examples where box-shadow in particular doesn&#8217;t quite manage what I need it to do, this post will present the workarounds I found. I&#8217;ll be referring [...]]]></description>
			<content:encoded><![CDATA[<p>Sort of as a follow-up to the previous post on html5 and css3, I&#8217;ve been applying css3 to various situations to see how it does.  I&#8217;ve run across a couple examples where box-shadow in particular doesn&#8217;t quite manage what I need it to do, this post will present the workarounds I found.</p>
<p>I&#8217;ll be referring to the use of varied shadow size and intensity to create a consistent sense of depth.  I highly recommend <a href="http://desktoppub.about.com/od/creategraphics/ss/dropshadows_4.htm">this summary</a> of the subject, which is actually what got me thinking about the second case here.</p>
<h5>Fixed menus and tabs</h5>
<p>What happens when you have a header (or other element) with a box shadow and tabs or a drop-down menu suspended from it?  Ideally, those items would have matching shadows to maintain the illusion of depth.  You may want something like the following image:</p>
<div id="attachment_299" class="wp-caption alignnone" style="width: 237px"><a href="http://www.pamgriffith.net/wp-content/2010/04/menushadow.gif" rel="lightbox[273]"><img class="size-full wp-image-299"  src="http://www.pamgriffith.net/wp-content/2010/04/menushadow.gif" alt="" width="227" height="194" /></a><p class="wp-caption-text">A drop-down menu below a header with a continuous shadow around the outside</p></div>
<p>Unfortunately, if you just have a shadow on each of the menus and the header you&#8217;re more likely to end up with something like one of these:</p>
<div id="attachment_301" class="wp-caption alignnone" style="width: 237px"><a href="http://www.pamgriffith.net/wp-content/2010/04/menushadow_inconsistent.gif" rel="lightbox[273]"><img class="size-full wp-image-301"  src="http://www.pamgriffith.net/wp-content/2010/04/menushadow_inconsistent.gif" alt="" width="227" height="194" /></a><p class="wp-caption-text">Two menus with inconsistent shadows</p></div>
<p>The menu on the left is inside the header element and positioned so the top of the menu is at the bottom of the header.  The menu&#8217;s shadow is cast on top of the header, which is probably not what anyone wants.</p>
<p>The problem with the one on the right is a little more subtle, and a lot of web designs do it all the time.  But it may not feel quite right, because <strong>shadow is an indication of depth</strong>.  The shadow cast on the menu is the same as that cast on the page, indicating that they are at the same depth, but the menu casts a shadow too, indicating that it is <em>not</em> at the same level as the page below the header.  It would actually be more consistent not to include a shadow from the right menu at all.</p>
<p>The left menu also has that problem: the header and menu cast the same shadow, indicating that they are at the same depth, but the shadow from the menu onto the header says that they are not.</p>
<p>One solution to this is to use something like the first menu but to <strong>cut off the shadow at the top</strong> that it casts onto the header to put the menu and the header at the same depth.  Overflow:hidden will do nicely for that.  (You might want to have your menu looking like it&#8217;s layered between the header and the body, I&#8217;ll get to that later.)</p>
<p>We&#8217;ll have the following html:</p>
<pre><code class="html">&lt;header&gt;
    &lt;nav&gt;
        &lt;ul&gt;
            &lt;li&gt;oranges&lt;/li&gt;
            &lt;li&gt;strawberries&lt;/li&gt;
            &lt;li&gt;grapes&lt;/li&gt;
            &lt;li&gt;lemons&lt;/li&gt;
        &lt;/ul&gt;
        &lt;ul&gt;
            &lt;li&gt;lettuce&lt;/li&gt;
            &lt;li&gt;cabbage&lt;/li&gt;
            &lt;li&gt;spinach&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/nav&gt;
&lt;/header&gt;</code></pre>
<p>There are two unordered lists nested inside a nav element.  (This example is html5, but of course you can use divs with classes too.)  The nav element is what we&#8217;ll use to trim off the tops of the menus.  The key css is here:</p>
<pre><code class="css">header { display: block; width: 100%; height: 100px; background-color: #FFC; box-shadow: 0 0 10px rgba(0,0,0,.5); }
nav { display: block; position: absolute; top: 100px; left: 0; width: 100%; overflow: hidden; padding-bottom: 10px; }
nav ul { margin: -10px 15px 0 15px; padding: 10px 0 0 0; float: left; background-color: #FFC; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,.5); }
nav ul li { margin: 0; padding: 5px 10px; list-style: none; }</code></pre>
<p>The nav is absolutely positioned to the bottom of the header with overflow:hidden.  The boxes for the unordered lists will start at the top of the nav, but the shadow will extend above the top edge of the nav and be cut off.  Here the lists also have a negative margin to cut off the top rounded corners instead of  using extra &#8220;border-top-radius&#8221; etc. styles, but that isn&#8217;t really necessary.</p>
<p style="text-align: center;"><a class="demo-popup-link demo-popup-id-css3 download_button" rel="demo" href="http://www.pamgriffith.net/demo/css3/menushadow.html">demo page</a></p>
<h5>Drop-down menus</h5>
<p>That all works great if you just want a static tab extending from your header, <strong>but if you want real interactive drop-down menus it gets a little more complicated</strong>.  Say we have the following:</p>
<pre><code class="html">&lt;header&gt;
    &lt;nav&gt;
        &lt;ul&gt;
            &lt;li&gt;fruit
                &lt;ul&gt;
                    &lt;li&gt;oranges&lt;/li&gt;
                    &lt;li&gt;strawberries&lt;/li&gt;
                    &lt;li&gt;grapes&lt;/li&gt;
                    &lt;li&gt;lemons&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;leafy greens
                &lt;ul&gt;
                    &lt;li&gt;lettuce&lt;/li&gt;
                    &lt;li&gt;cabbage&lt;/li&gt;
                    &lt;li&gt;spinach&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/nav&gt;
&lt;/header&gt;</code></pre>
<p>Each of the drop-down menus is now inside another list element that contains the header for that menu.  The menu headers should appear inside the header, and hovering or clicking should cause the menu to appear.</p>
<p>We can&#8217;t just use the nav element to cut off the top anymore because that will clip the header too.  I keep saying how awesome css is in letting us take out extra elements we&#8217;ve been using for rounded corners and shadows, but we&#8217;re going to have to put one back in for this (<em>d&#8217;oh</em>).  Lets wrap each of the drop-down menus in another nav (or div, or whatever you like&#8211;semantics people can argue about that one, nav seemed appropriate to me):</p>
<pre><code class="html">&lt;header&gt;
    &lt;nav&gt;
        &lt;ul&gt;
            &lt;li&gt;fruit
                &lt;nav&gt;
                    &lt;ul&gt;
                        &lt;li&gt;oranges&lt;/li&gt;
                        &lt;li&gt;strawberries&lt;/li&gt;
                        &lt;li&gt;grapes&lt;/li&gt;
                        &lt;li&gt;lemons&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/nav&gt;
            &lt;/li&gt;
            &lt;li&gt;leafy greens
                &lt;nav&gt;
                    &lt;ul&gt;
                        &lt;li&gt;lettuce&lt;/li&gt;
                        &lt;li&gt;cabbage&lt;/li&gt;
                        &lt;li&gt;spinach&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/nav&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/nav&gt;
&lt;/header&gt;</code></pre>
<p>Now it will be the inner nav only that gets positioned at the bottom of the header with overflow:hidden:</p>
<pre><code class="css">nav nav { position: absolute; top: 30px; left: 0; padding: 0 20px 10px 20px; overflow: hidden; }
nav ul ul { display: none; background-color: #FFC; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,.5); border: 1px solid #979700; margin: -10px -10px 0 -10px; padding-top: 10px; }
nav ul li:hover ul { display: block; }
nav ul ul li { float: none; padding: 5px 10px; }</code></pre>
<p>Notice the extra margins and paddings in there to make sure the list is lined up correctly and the nav element isn&#8217;t cutting off any other sides of the shadow.</p>
<p style="text-align: center;"><a class="demo-popup-link demo-popup-id-css3 download_button" rel="demo" href="http://www.pamgriffith.net/demo/css3/menushadow2.html">demo page</a></p>
<h5>Multiple shadow depths</h5>
<p>What if you want to have two elements overlapping at different distances from the background (i.e., something with a longer, lighter shadow on top of something with a shorter, darker one).  The shadow of the upper element will need to be shorter where it overlaps the second element than where it is over the background.</p>
<p>You can use this technique on the drop-down menus mentioned above tomake them look like they&#8217;re lower than the header they&#8217;re dropping from, but lets start with something simpler first.  Let&#8217;s say you have a header with a shadow and a sidebar that should look like it&#8217;s half way between the header and the background page.  You may want to end up with something like this:</p>
<div id="attachment_276" class="wp-caption alignnone" style="width: 434px"><a href="http://www.pamgriffith.net/wp-content/2010/04/shadowdepth.gif" rel="lightbox[273]"><img class="size-full wp-image-276"  src="http://www.pamgriffith.net/wp-content/2010/04/shadowdepth.gif" alt="" width="424" height="287" /></a><p class="wp-caption-text">Shadows of varying perceived depths</p></div>
<p>I&#8217;ve made the header shadow spread 20px and the shadows on top of and cast from the sidebar 10px each to add up to 20.  You could also make it 5 and 15, or some other ratio you like.  I&#8217;ve also made them slightly darker, but I can&#8217;t think of a formula to use for that.</p>
<p>If you just have the header cast the shadow and the sidebar cast a separate shadow it will be a uniform 20px all the way across.  What we want is two separate shadows under the header in addition to the one cast by the sidebar.  Unfortunately, we&#8217;re going to have to add extra elements to get that.</p>
<p>What we need is one shadow to go all the way across at the bottom of the header underneath the sidebar and another above the sidebar but below the real header so it&#8217;s possible to click through to the logo or whatever else is in there.  That means something like this:</p>
<pre><code class="html">&lt;div class="fakeshadow"&gt;&lt;/div&gt;
&lt;header&gt;&lt;/header&gt;
&lt;nav&gt;
    &lt;div class="fakeshadow"&gt;&lt;/div&gt;
&lt;/nav&gt;</code></pre>
<p>There are two extra elements there, one just in the body and one inside the nav element that&#8217;s going to be the sidebar.</p>
<p>The nav and the &#8220;fakeshadow&#8221; element inside it will have the 10px shadow.  The &#8220;fakeshadow&#8221; div above the header will go under everything and have the 20px shadow, which the nav will cover.  Here&#8217;s the css:</p>
<pre><code class="css">header { display: block; position: relative; z-index: 2; width: 100%; height: 100px; background-color: #FFC; }
.fakeshadow { position: absolute; top: 0; left: 0; z-index: 0; width: 100%; height: 100px; box-shadow: 0 0 20px rgba(0,0,0,.5); }
nav { position: absolute; top: 0; left: 0; z-index: 1; width: 200px; height: 100%; background-color: #3CF; box-shadow: 0 0 10px rgba(0,0,0,.7); }
nav .fakeshadow { box-shadow: 0 0 10px rgba(0,0,0,.7); }</code></pre>
<p style="text-align: center;"><a class="demo-popup-link demo-popup-id-css3 download_button" rel="demo" href="http://www.pamgriffith.net/demo/css3/sidebarshadow.html">demo page</a></p>
<h5>Combining everything: drop-down menus with multiple shadow depths</h5>
<p>If we add some of those &#8220;fakeshadow&#8221; elements to the drop down menus and adjust the menu shadow, we can get something like this:</p>
<div id="attachment_303" class="wp-caption alignnone" style="width: 237px"><a href="http://www.pamgriffith.net/wp-content/2010/04/menushadow_multidepth.gif" rel="lightbox[273]"><img class="size-full wp-image-303"  src="http://www.pamgriffith.net/wp-content/2010/04/menushadow_multidepth.gif" alt="" width="227" height="194" /></a><p class="wp-caption-text">Drop-down menus with multiple shadow levels so menus look like they&#39;re closer to the background</p></div>
<p>The fakeshadow element is added to the drop-down list, so the html looks like this:</p>
<pre><code class="html">&lt;header&gt;
    &lt;nav&gt;
        &lt;ul&gt;
            &lt;li&gt;fruit
                &lt;nav&gt;
                    &lt;ul&gt;
                        &lt;li class="fakeshadow"&gt;&lt;/li&gt;
                        &lt;li&gt;oranges&lt;/li&gt;
                        &lt;li&gt;strawberries&lt;/li&gt;
                        &lt;li&gt;grapes&lt;/li&gt;
                        &lt;li&gt;lemons&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/nav&gt;
            &lt;/li&gt;
            &lt;li&gt;leafy greens
                &lt;nav&gt;
                    &lt;ul&gt;
                        &lt;li class="fakeshadow"&gt;&lt;/li&gt;
                        &lt;li&gt;lettuce&lt;/li&gt;
                        &lt;li&gt;cabbage&lt;/li&gt;
                        &lt;li&gt;spinach&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/nav&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/nav&gt;
&lt;/header&gt;</code></pre>
<p>The fake shadow has a box shadow of 4px and the lists now have a shadow of only 6, so the modified css looks like this:</p>
<pre><code class="css">header { display: block; position: relative; width: 100%; height: 100px; background-color: #FFC; box-shadow: 0 0 10px rgba(0,0,0,.5); }

nav { position: absolute; top: 70px; left: 0; }
nav ul, nav li { margin: 0; padding: 0; }
nav ul li { list-style: none; float: left; padding: 5px 20px; position: relative; }

nav nav { position: absolute; top: 30px; left: 0; padding: 0 20px 10px 20px; overflow: hidden; }
nav ul ul { display: none; background-color: #F5F5BA; border-radius: 10px; box-shadow: 0 0 6px rgba(0,0,0,.5); margin: -10px -10px 0 -10px; padding-top: 10px; }
nav ul li:hover ul { display: block; }
nav ul ul li { float: none; padding: 5px 10px; }
nav ul ul li.fakeshadow { padding:0; height:1px; left:0; margin-top:-2px; box-shadow:0 0 4px rgba(0, 0, 0, 1); }</code></pre>
<p>The background color was also adjusted a little bit to bring out the effect.</p>
<p style="text-align: center;"><a class="demo-popup-link demo-popup-id-css3 download_button" rel="demo" href="http://www.pamgriffith.net/demo/css3/menushadow3.html">demo page</a></p>
<h5>Bonus: Animated tabs</h5>
<p><em>Added 3/15/10 because I can&#8217;t seem to get the idea out of my head</em></p>
<p>In this example, the tabs move when you hover over them but the shadow remains stationary.  It also demonstrates the use of :before (or :after) instead of using a completely separate element in the html.</p>
<div id="attachment_314" class="wp-caption alignnone" style="width: 338px"><a href="http://www.pamgriffith.net/wp-content/2010/04/hovertabs.png" rel="lightbox[273]"><img class="size-full wp-image-314"  src="http://www.pamgriffith.net/wp-content/2010/04/hovertabs.png" alt="" width="328" height="108" /></a><p class="wp-caption-text">Tabs with shadows and hover states</p></div>
<p>The tabs are each li elements with a style similar to that applied to the menu ul above:</p>
<pre><code class="html">&lt;header&gt;
    &lt;nav&gt;
        &lt;ul&gt;
            &lt;li&gt;oranges&lt;/li&gt;
            &lt;li&gt;strawberries&lt;/li&gt;
            &lt;li&gt;grapes&lt;/li&gt;
            &lt;li&gt;lemons&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/nav&gt;
&lt;/header&gt;</code></pre>
<p>There are no fake elements this time&#8211;we can also add those fake shadows with :before or :after pseudo-elements.  Here&#8217;s the css:</p>
<pre><code class="css">nav ul { margin: 0; padding: 0; list-style: none; }
nav ul li { margin: -10px 5px 0 5px; padding: 10px 5px 5px; float: left; background-color: #F5F5BA; border-radius: 10px; box-shadow: 0 0 6px rgba(0,0,0,.5); position: relative; cursor: pointer; }
nav ul li:before { content: ' '; height:1px; width: 100%; position: absolute; left: 0; top: 9px; box-shadow:0 0 4px rgba(0, 0, 0, 1); }
nav ul li:hover { padding-top: 15px; background-color: #FDEBB3; }</code></pre>
<p style="text-align: center;"><a rel="demo" class="demo-popup-link demo-popup-id-css3 download_button" href="http://www.pamgriffith.net/demo/css3/menushadow4.html">demo page</a></p>

	<script>
		jQuery(document).ready(function () { demo_popup.init({width:500,height:300,title:'CSS Shadows',interactive:true});});
	</script>
]]></content:encoded>
			<wfw:commentRss>http://www.pamgriffith.net/blog/complex-uses-of-css3-box-shadow/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTML5, CSS3, and the Great CSS-Off</title>
		<link>http://www.pamgriffith.net/blog/html5-css3-and-the-great-css-off</link>
		<comments>http://www.pamgriffith.net/blog/html5-css3-and-the-great-css-off#comments</comments>
		<pubDate>Wed, 17 Mar 2010 06:09:13 +0000</pubDate>
		<dc:creator>Pam Griffith</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.pamgriffith.net/?p=187</guid>
		<description><![CDATA[A while back I entered the Great CSS-Off over at CSS-Tricks.  You can find my file here.  I used the contest as an excuse to play with html5, css3, and using only semantically meaningful markup.  It was an interesting experience, and I&#8217;d like to share some of the things I discovered. HTML5 I found myself [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I entered the <a href="http://css-tricks.com/css-off-results/">Great CSS-Off</a> over at <a href="http://css-tricks.com">CSS-Tricks</a>.  You can find my file <a href="http://www.pamgriffith.net/demo/cssoff">here</a>.  I used the contest as an excuse to play with html5, css3, and using <strong>only </strong>semantically meaningful markup.  It was an interesting experience, and I&#8217;d like to share some of the things I discovered.</p>
<h5>HTML5</h5>
<p>I found myself wanting a &lt;content&gt; element to match &lt;header&gt; and &lt;footer&gt;.  I&#8217;ve found this on several other projects I&#8217;ve messed about with html5 on, too.  I&#8217;ve since been told that &#8220;everything that isn&#8217;t in &lt;header&gt; or &lt;footer&gt; tags is content, so you don&#8217;t need it,&#8221; but</p>
<ul>
<li>It&#8217;s a useful styling wrapper to prevent a lot of redundant css (and ok, maybe css isn&#8217;t a very good reason to include markup if you&#8217;re going semantic)</li>
<li>It feels really semantically inappropriate to put all my &lt;p&gt;, &lt;img&gt;, etc. tags at the same tree-level as &lt;header&gt; and &lt;footer&gt;.  They are not the same level of content.  I guess I could use &lt;section&gt;, but it still feels like section should be something that goes inside &lt;header&gt;, &lt;footer&gt;, and &lt;content&gt;.</li>
</ul>
<p>I also discovered that I don&#8217;t really understand &lt;hgroup&gt;.  Can/should I put it around my headers if there&#8217;s only one?  What if there&#8217;s a possibility that I might add/remove headers later?  What&#8217;s up with this &#8220;document outline&#8221; thing, how do I preview it to see if it&#8217;s doing what I meant?  Can I use it for markup?</p>
<p>It also seems like html5 and microformats don&#8217;t naturally coexist very nicely, but I guess they&#8217;re working on that.</p>
<h5>CSS(3)</h5>
<p>There are a lot of cool new things in css3, and it really can be used to substantially reduce markup (no more decorative rounded corner &lt;span class=&#8221;bottom right&#8221;&gt;&lt;/span&gt; caps, woo!), especially when combined with things like :before and :after.  Border images are awesome, and I really love the button styles I was able to get with a combination of border-radius, background gradients, and box-shadow:</p>
<div id="attachment_193" class="wp-caption alignnone" style="width: 170px"><a href="http://www.pamgriffith.net/wp-content/2010/03/buttonstyle.jpg" rel="lightbox[187]"><img class="size-full wp-image-193"  src="http://www.pamgriffith.net/wp-content/2010/03/buttonstyle.jpg" alt="" width="160" height="120" /></a><p class="wp-caption-text">&quot;Keep reading&quot; button with base style (top), hover style (middle) and active style (bottom) using CSS3</p></div>
<pre><code class="css">/* css to create the above buttons; text styles and -moz and -webkit prefix versions removed for space */
.more, .more:visited {
    line-height: 25px;
    color: #e97e7e;
    border: 1px solid #88706c;
    padding: 0 13px;
    border-radius: 13px;
    box-shadow: 0 0 3px rgba(0, 0, 0, .5);
    background-color: rgb(110, 38, 38);
    background-image: -moz-linear-gradient(#934d4d, #6f2828);
    background-image: -webkit-gradient(linear, 0% 0%, 0% 90%, from(#934d4d), to(#6f2828));
}
.more:hover, .more:focus { /* increase brightness by 10% */
    color: #ffa1a1;
    background-color: rgb(135, 47, 47);
    background-image: -moz-linear-gradient(#ad5c5c, #8a3232);
    background-image: -webkit-gradient(linear, 0% 0%, 0% 90%, from(#ad5c5c), to(#8a3232));
}
.more:active { /* increase saturation by 10% and add an inner shadow */
    color: #e87b7b;
    background-color: rgb(135, 34, 34);
    background-image: -moz-linear-gradient(#944040, #701d1d);
    background-image: -webkit-gradient(linear, 0% 0%, 0% 90%, from(#944040), to(#701d1d));
    box-shadow: 0 0 3px rgba(0, 0, 0, .7), inset 0 3px 3px rgba(0, 0, 0, .5);
}</code></pre>
<p>However, despite all the new developments I still ran into a lot of limitations that it really seems like css should have overcome by now.</p>
<h6>Text pseudoclasses: first n words, nth line, etc.</h6>
<p>The mockup for the contest had the first three words of each paragraph bolded.  This seemed like a purely stylistic, not semantic, boldening, but all css gives you is first-line and what I needed was first-n-words.  Similarly, there were quotations at the bottom that had 3 lines each, each with a different color.  Again, purely stylistic, not semantic, so I didn&#8217;t want to add markup, but how do you get 3 different colors when all you have is first-line?  I ended up using javascript for both of those, and the second one ended up being a pretty seriously ugly hack.</p>
<p><em>It&#8217;s been pointed out to me that these are pseudoelements, not pseudoclasses.  To this I reply that I do not want to have to care.  I would like to be able to do anything I can do with one with the other (&#8220;p:first-line a&#8221;, anyone?), and I don&#8217;t want to have to remember (or constantly look up) which one has the stupid new double colon notation.</em></p>
<h6>Flexible floated image placement</h6>
<p>Magazines layouts float images to an arbitrary position up or down from where they naturally fit in the text all the time, but it requires a <a href="http://www.xs4all.nl/~jer03n/sandbox/float-bottom-right.html">bit of a hack</a> to do it for the web, and even then you can only do downward.  And while we&#8217;re talking about how magazines use floats that aren&#8217;t possible on the web, how about floating between columns or floating around an arbitrary shape?</p>
<h6>:before and :after</h6>
<p>I tried to avoid adding any purely decorative elements to the html, and added them with :before and :after.  But there comes a point when that gets difficult, since you can only add <em>one thing </em>for each of those.  I started out using :before to get a decorative page fold image to show up at the top left of the main article, but I also needed to use that to get the element that pushes down the image for the afore-mentioned image float hack.  I got around it by using multiple backgrounds for the browsers that support it and javascript for those that don&#8217;t, but I really wished it were possible to have multiple :before elements.  I was also frustrated by the inability to apply certain css to things included in this way (e.g. width and height for images), and by the ugliness of things like &#8216;content: &#8220;\2192&#8243;&#8216; (that inserts a right arrow, can&#8217;t you tell?).</p>
<p>Sure, I could just avoid all that by using javascript in all cases, but I prefer to leave the one-off things like this out of my javascript and keep it with the rest of the style of the element it applies to wherever possible.  Or maybe I&#8217;m just justifying an underlying discomfort in applying styles with javascript that&#8217;s becoming less appropriate these days.</p>
<h6>Webkit developers don&#8217;t pay enough attention to detail</h6>
<p>I&#8217;ll forgive them for the new stuff&#8211;it&#8217;s not standard, it&#8217;s not finished, and it&#8217;s got a big &#8220;-webkit-&#8221; red flag on it to say &#8220;use with caution.&#8221;  But <a href="http://www.w3.org/TR/CSS1/#floating-elements">floats are CSS1</a>, so by now I expect better than the following:</p>
<div id="attachment_189" class="wp-caption alignnone" style="width: 424px"><a href="http://www.pamgriffith.net/wp-content/2010/03/textonfloat.jpg" rel="lightbox[187]"><img class="size-full wp-image-189"  src="http://www.pamgriffith.net/wp-content/2010/03/textonfloat.jpg" alt="" width="414" height="252" /></a><p class="wp-caption-text">A floated image with text shown in Firefox (left) and Webkit (right). Text on top of the image is circled on the right.</p></div>
<p>There should not be text on top of that floated image!  I think this is related to the float hack mentioned above.  There is a 1px wide div shoving the figure down to the appropriate position.  I think maybe Webkit is only checking alignment at the top of the line, which is aligned with the 1px div correctly, but the bottom crosses into the second, wider floated element.  All other browsers that honor the 1px pusher div seem to check the whole height of the text line.</p>
<p>I also keep running into trouble with new properties being incompletely or incorrectly implemented.  I understand that they&#8217;re new, not yet fully standardized, and not yet finished, but it does highlight a different development ideology from other browsers, which I find interesting.  So the couple of things aren&#8217;t really complaints so much fun quirks I ran across and feel like documenting.</p>
<p>The one I&#8217;ve run into the most different problems with is box-shadow.  On previous projects I&#8217;ve hit problems like the property being thrown out if the word &#8220;inset&#8221; was added to just one of the shadows or the shadow having a thin line of background between it and box it surrounded.  This time everything was much nicer, but I did notice the following on the inset button described above:</p>
<div id="attachment_224" class="wp-caption alignnone" style="width: 285px"><a href="http://www.pamgriffith.net/wp-content/2010/03/chromebutton1.jpg" rel="lightbox[187]"><img class="size-full wp-image-224"  src="http://www.pamgriffith.net/wp-content/2010/03/chromebutton1.jpg" alt="" width="275" height="90" /></a><p class="wp-caption-text">The depressed state of the &quot;keep reading&quot; button in Chrome; square corners from the shadow appear outside the rounded button edges.</p></div>
<p>There&#8217;s an inner shadow to show that the button is depressed, but in Chrome the shadow doesn&#8217;t get clipped to the rounded button edge.  Safari just ignores the &#8220;inset&#8221; part of the shadow rule but now keeps the rest.</p>
<p>Another interesting thing I ran across, but fortunately pretty easy to get around in this case, was borders and rgba colors.  It seems that Webkit overlays the colors of both sides at the corners, which isn&#8217;t noticeable when they&#8217;re all solid and the same color, but can lead to dark squares with rgba:</p>
<div id="attachment_223" class="wp-caption alignnone" style="width: 317px"><a href="http://www.pamgriffith.net/wp-content/2010/03/chromecorners.jpg" rel="lightbox[187]"><img class="size-full wp-image-223"  src="http://www.pamgriffith.net/wp-content/2010/03/chromecorners.jpg" alt="" width="307" height="330" /></a><p class="wp-caption-text">An rgba border in Webkit with dark squares where transparent sides overlap circled in red</p></div>
<p>To get around it here, I ended up switching from using borders to using an rgba background color, which then allowed me to get the extra highlight details at the top and left using borders instead of box-shadow as originally planned. (Isn&#8217;t it cool how flexible css can be?)</p>
<h6>All these cool features make me want more cool features!</h6>
<p>Apparently I can never be satisfied.  Two big things I want, in addition to the things mentioned above that it seems like css should already have, are blending modes (e.g. multiply, overlay, etc. that you can do in Photoshop and other image editors) and alpha masks.  And of course it would be great if some of the new things had more flexibility, like letting me change the box shadow gradient curve from solid to transparent independently of total alpha and spread, or allowing gradients along a specified path in addition to radial and linear.</p>
<p><em>Edit: Apparently WebKit <a href="http://developer.apple.com/safari/library/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Masks/Masks.html#//apple_ref/doc/uid/TP40008032-CH8-SW8">does masks</a>, awesome!</em></p>
<h5>Conclusion</h5>
<p>All in all this was a great learning experience for me, getting to know the new elements and styles.  I&#8217;ve since thought of other new things I could have added, like the flexible box model.  I guess I&#8217;ll have to think of another project for those.</p>
<p>I griped about Webkit above, but really the support for CSS3 and HTML5 is pretty good in the browsers that support it at all, with more to come in Opera soon and potentially even IE9.</p>
<p>I still wouldn&#8217;t use HTML5, at least, for any real projects&#8211;check out the <a href="http://www.pamgriffith.net/demo/cssoff">page</a> in IE with javascript turned off, ick!  But progressive enhancement with CSS3 rounded corners, box shadow, RGBA, etc. are definitely on the menu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pamgriffith.net/blog/html5-css3-and-the-great-css-off/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design guide for aural css?</title>
		<link>http://www.pamgriffith.net/blog/design-guide-for-aural-css</link>
		<comments>http://www.pamgriffith.net/blog/design-guide-for-aural-css#comments</comments>
		<pubDate>Wed, 23 Dec 2009 06:34:58 +0000</pubDate>
		<dc:creator>Pam Griffith</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.pamgriffith.net/blog/?p=55</guid>
		<description><![CDATA[I&#8217;ve been thinking a lot about the aural css properties today&#8211;things like azimuth, pitch, voice-family, etc. that are theoretically available to screen readers.  Visual design guides are all over the place, a lot of them adapted from or comparing the web to print media.  They say things like &#8220;your lines shouldn&#8217;t be longer than X [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking a lot about the <a href="http://www.w3.org/TR/CSS2/aural.html">aural css properties</a> today&#8211;things like azimuth, pitch, voice-family, etc. that are theoretically available to screen readers.  Visual design guides are all over the place, a lot of them adapted from or comparing the web to print media.  They say things like &#8220;your lines shouldn&#8217;t be longer than X characters&#8221; or &#8220;you need to have contrast between your headings and your text&#8221; or &#8220;the ratio of your line height to your font size should be X&#8221; or &#8220;don&#8217;t fill up the whole page, leaving white space makes things easier to read.&#8221;</p>
<p>But I&#8217;ve been looking around and I can&#8217;t find anything of the sort for aural web design, other than that you should use those properties to make your designs less terrible for people on screen readers.    You might be able to adapt from radio guidelines, if such things exist, but it doesn&#8217;t look like anyone has yet.</p>
<p>Am I wrong?  I&#8217;m sure there are some conventions shared between screen readers for default aural stylesheets the way that visual browsers do, but I admit I haven&#8217;t spent much time with screen readers.  And I&#8217;m sure some improvements you could come up with off-hand, like adding a pause before and after headings, which I suspect is one of the screen readers&#8217; defaults.  But some things don&#8217;t have direct analogues to visual styles&#8211;what does a hyperlink sound like?  How about when you hover over it?  And according to <a href="http://sonify.psych.gatech.edu/~walkerb/">Professor Bruce Walker</a> in an Intro to HCI course I took a couple years ago, there are some things that the blind and the sighted just conceive of differently, like high vs low pitch to mean something large.</p>
<p>I&#8217;ve never attempted to design an aural stylesheet, but I&#8217;m genuinely curious now and probably will.  If you know of a style guide (or several), please let me know in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pamgriffith.net/blog/design-guide-for-aural-css/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
