<?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>Postpostmodern &#187; CSS</title>
	<atom:link href="http://postpostmodern.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://postpostmodern.com</link>
	<description>Speaking of web development.</description>
	<lastBuildDate>Wed, 11 Jan 2012 00:21:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Body with Class</title>
		<link>http://postpostmodern.com/instructional/a-body-with-class/</link>
		<comments>http://postpostmodern.com/instructional/a-body-with-class/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 23:07:12 +0000</pubDate>
		<dc:creator>Jason Johnson</dc:creator>
				<category><![CDATA[Instructional]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://postpostmodern.com/?p=228</guid>
		<description><![CDATA[Ease section-specific styling by adding classes to your body tag.]]></description>
			<content:encoded><![CDATA[<h2>This Short Version</h2>

<p>Add a class attribute to your <body> tag for each part of the page&#8217;s path in the URL. E.g.: The page <em>http://example.com/about/history</em> should have a body tag that looks like <code>&lt;body class="about history"&gt;</code>. It makes styling those sections of your site nice and simple.</p>

<h2>The Explanation</h2>

<p>Often times, specific styling/formatting is shared between similar pages. The traditional way to deal with this is to include additional CSS files when special formatting is needed. I&#8217;ve found body classing to be more useful and more efficient.<sup><a href="#footnote-1-228" id="footnote-link-1-228" title="See the footnote.">1</a></sup></p>

<p>Since the pages that share styling often also share a path in the url, it&#8217;s really simple to add the path parts as classes to the body tag. For example, say the <strong><em>about</em></strong> section of a web site needs special formatting because it has an extra sidebar or maybe some sort of widget. I would add the class &#8216;about&#8217; to the body tag of all of the about pages. This method continues down the hierarchy. The page at <strong><em>/about/history</em></strong> would have a body class of &#8216;about history&#8217;, and so on. It&#8217;s very simple and very handy.</p>

<p>It&#8217;s also very simple to add this functionality to your layouts whether you&#8217;re using Rails or any other framework. My PHP framework, <a href="http://github.com/postpostmodern/phooey/tree">Phooey</a>, does it for you automatically.</p>

<p>For Rails, you can include this in your layout:</p>

<p><code>&lt;body class="&lt;%= controller_name -%&gt; &lt;%= action_name -%&gt;"&gt;</code></p>

<p>&#8230;or, if you&#8217;re using Haml (which I highly recommend):</p>

<p><code>%body{:class =&gt; "#{controller_name} #{action_name}"}</code></p>

<p>Agree? Disagree? Confused? Let me know down there in the comments.<br /></p>

<ol class="footnotes"><li id="footnote-1-228">I am of the opinion that you should only include <em>one CSS file per media type</em> in any page of your site (except for the IE stylesheets). I usually include only the following stylesheets in every page of every site: all.css, screen.css, print.css. And each one of those is minified. More on this in my forthcoming article on Sass.  <a href="#footnote-link-1-228">&#8593; back up there</a></li></ol>
]]></content:encoded>
			<wfw:commentRss>http://postpostmodern.com/instructional/a-body-with-class/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Pseudo Pseudo Classes</title>
		<link>http://postpostmodern.com/instructional/pseudo-pseudo-classes/</link>
		<comments>http://postpostmodern.com/instructional/pseudo-pseudo-classes/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 05:16:19 +0000</pubDate>
		<dc:creator>Jason Johnson</dc:creator>
				<category><![CDATA[Instructional]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://postpostmodern.com/?p=384</guid>
		<description><![CDATA[Simple jQuery snippet to get some pseudo-classes]]></description>
			<content:encoded><![CDATA[<p>The <code>:first-child</code> and <code>:last-child</code> pseudo classes in CSS are super-handy for stying things like lists. For example, if you want a horizontal line between list items, you can set:</p>

<pre><code>ul li {
  border-bottom: solid 1px #e0e0e0;
}
ul li:last-child {
  border: none;
}
</code></pre>

<p>Unfortunately, most current browsers can&#8217;t stomach <code>:first-child</code> and <code>:last-child</code>. :(</p>

<p>But just a teaspoon of jQuery will make that pseudo-class medicine go right down:</p>

<pre><code lang='javascript'>function firstLast()
{
  $('ul li:first-child').addClass('first');
  $('ul li:last-child').addClass('last');
}
jQuery(firstLast);
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://postpostmodern.com/instructional/pseudo-pseudo-classes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Global AJAX Cursor Change</title>
		<link>http://postpostmodern.com/instructional/global-ajax-cursor-change/</link>
		<comments>http://postpostmodern.com/instructional/global-ajax-cursor-change/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 22:08:54 +0000</pubDate>
		<dc:creator>Jason Johnson</dc:creator>
				<category><![CDATA[Instructional]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://postpostmodern.com/?p=290</guid>
		<description><![CDATA[Two snippets to let users know when your web app is busy AJAXing.]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know if I&#8217;ve ever mentioned this before, but in case I haven&#8217;t:</p>

<h2>Something to this effect should be used on all AJAX web pages:</h2>

<pre><code lang='javascript'>function globalAjaxCursorChange() 
{
  $("html").bind("ajaxStart", function(){
     $(this).addClass('busy');
   }).bind("ajaxStop", function(){
     $(this).removeClass('busy');
   });
}
</code></pre>

<p>Along with this CSS:</p>

<pre><code lang='css'>html.busy, html.busy * {
  cursor: wait !important;
}
</code></pre>

<p>The javascript above is jQuery, but I used to do the same type of thing back when I used Prototype.</p>

<p>Developers sometimes go to great lengths to supplement the native behavior of a system with custom &#8216;busy&#8217; indicators. And that&#8217;s great, but don&#8217;t forget what&#8217;s built-in. Users instinctively know that something&#8217;s working when they see the old hourglass/watch cursor.</p>
]]></content:encoded>
			<wfw:commentRss>http://postpostmodern.com/instructional/global-ajax-cursor-change/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

