<?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>Catch My Fame &#187; CSS</title>
	<atom:link href="http://www.catchmyfame.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.catchmyfame.com</link>
	<description>A web designoper&#039;s journal</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:18:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A Guide to CSS2 and CSS3 Pseudo-classes and Pseudo-elements</title>
		<link>http://www.catchmyfame.com/2010/05/01/a-guide-to-css2-and-css3-pseudo-classes-and-pseudo-elements/</link>
		<comments>http://www.catchmyfame.com/2010/05/01/a-guide-to-css2-and-css3-pseudo-classes-and-pseudo-elements/#comments</comments>
		<pubDate>Sat, 01 May 2010 18:17:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.catchmyfame.com/?p=528</guid>
		<description><![CDATA[While the term &#8220;pseudo-class&#8221; might not instantly evoke what it refers to, virtually every web developer and web designer has used them. The classic example of pseudo-classes involves styling links based on the state that they&#8217;re in (hover, active, etc.). CSS3 introduces over a dozen new CSS pseudo classes to give you more control over [...]]]></description>
			<content:encoded><![CDATA[<p>While the term &#8220;pseudo-class&#8221; might not instantly evoke what it refers to, virtually every web developer and web designer has used them. The classic example of pseudo-classes involves styling links based on the state that they&#8217;re in (hover, active, etc.). CSS3 introduces over a dozen new CSS pseudo classes to give you more control over targeting and styling elements. CSS2 pseudo-classes still work in CSS3, and CSS2&#8242;s pseudo elements are virtually unchanged in CSS3 (see the last paragraph). Below is a chart that outlines pseudo-classes in CSS2 and CSS3 with<strong> new CSS3 pseudo-classes in bold</strong>.<span id="more-528"></span></p>
<table id="examples" style="border-collapse: separate; border: 1px solid #ddd;">
<tbody>
<tr>
<th>Pseudo-class</th>
<th>Description</th>
<th>Notes/Example</th>
</tr>
<tr>
<td>:active</td>
<td>Typically applied to links although it work with other elements. Applied when the user clicks on the selected element.</td>
<td>a:active{}</p>
<p>p:active{}</td>
</tr>
<tr>
<td><strong>:checked</strong></td>
<td>Applies to radio and checkbox form elements that are selected or checked.</td>
<td>input:checked{}</td>
</tr>
<tr>
<td><strong>:disabled</strong></td>
<td>Selects elements (usually input) that have the disabled attribute set to disabled (e.g. disabled=&#8221;disabled&#8221;). This is the opposite of :enabled.</td>
<td>input:disabled{}</td>
</tr>
<tr>
<td><strong>:empty</strong></td>
<td>Used to select elements with no children</td>
<td>&lt;p&gt;&lt;/p&gt;</td>
</tr>
<tr>
<td><strong>:enabled</strong></td>
<td>Selects elements (usually input) that are in an enabled state (the default). This is the opposite of :disabled.</td>
<td>input:enabled{}</td>
</tr>
<tr>
<td>:first-child</td>
<td>Selects the element that is the first child of another element. Equivalent to :nth-child(1). In a list, the :first-child selector placed on the the list item would select the first item in the list.</td>
<td>div &gt; p:first-child li:first-child</td>
</tr>
<tr>
<td><strong>:first-of-type</strong></td>
<td>Selects an element that is the first sibling of its type in the list of children of its parent element. Equivalent to :nth-of-type(1). This differs from :first-child in that it can the item selected may not be the first child node. For example, consider a div that contained multiple paragraph and image tags. The :first-of-type applied to the img tag within the div would select the first image even though it may not be the first child within the div.</td>
<td>dl dt:first-of-type div &gt; img:first-of-type</td>
</tr>
<tr>
<td>:focus</td>
<td>Usually applied to links and input elements. Applied when an element receives focus via the keyboard or mouse.</td>
<td>input:focus{}</p>
<p>a:focus{}</td>
</tr>
<tr>
<td>:hover</td>
<td>Typically applied to links although it works with other elements. Applied when the user hovers over the selected element.</td>
<td>a:hover{}</p>
<p>p:hover{}</td>
</tr>
<tr>
<td><strong>:indeterminate</strong></td>
<td>Applies to radio and checkbox form elements in an indeterminate or uncertain state. This state is usually set via JavaScript or an attribute in HTML5 (e.g. document.getElementsByTagName(&#8220;input&#8221;)[0].indeterminate = true;).</td>
<td></td>
</tr>
<tr>
<td>:lang</td>
<td>Used to select elements with a lang attribute</td>
<td>&lt;span lang=&#8221;ja&#8221;&gt;</td>
</tr>
<tr>
<td><strong>:last-child</strong></td>
<td>Selects the element that is the last child of another element. Equivalent to :nth-last-child(1)</td>
<td>li:last-child selects the last item in a list</td>
</tr>
<tr>
<td><strong>:last-of-type</strong></td>
<td>Selects an element that is the last sibling of its type in the list of children of its parent element. Equivalent to :nth-last-of-type(1). This differs from :last-child in that it can the item selected may not be the last child node. For example, consider a div that contained multiple paragraph and image tags. The :last-of-type applied to the img tag within the div would select the last image even though it may not be the last child within the div.</td>
<td>tr &gt; td:last-of-type selects the last table cell in every row</td>
</tr>
<tr>
<td>:link</td>
<td>Usually applied to um, links</td>
<td></td>
</tr>
<tr>
<td><strong>:not()</strong></td>
<td>Special. Takes another CSS selector (e.g. :last-child) as an argument and selects the opposite group. For example, li:not(:last-child) would select all list items in a list except the last one. This selector can&#8217;t be used by itself, nested, or used with pseudo-elements (see below).</td>
<td>li:not(:last-child) { font-style:italic; } selects all list item elements except the last one.</td>
</tr>
<tr>
<td><strong>:nth-child()</strong></td>
<td>The W3C has a wonderful explanation for this Swiss army knife of a selector that&#8217;s about as clear as mud, but very useful. <em>&#8220;The :nth-child(an+b) pseudo-class notation represents an element that has an+b-1 siblings before it in the document tree, for any positive integer or zero value of n, and has a parent element. For values of a and b greater than zero, this effectively divides the element&#8217;s children into groups of a elements (the last group taking the remainder), and selecting the bth element of each group&#8221;</em>.<br />
If you understood that after one read through you probably live in your parent&#8217;s basement.This selector is especially useful on tables and lists but it works virtually anywhere. In a nutshell it allows you to selectively pick elements based on their position. This differs from the :first and :last pseudo classes that target only the first or last occurrence of an element. Aside from using the an+b notation, it also accepts &#8216;odd&#8217; and &#8216;even&#8217; as arguments. For example, :nth-child(odd) is equivalent to  :nth-child(2n+1). Note that when using the  equation format that n starts at zero. The  arguments passed to this selector (if not using &#8216;odd&#8217; or &#8216;even&#8217;) must be in the format: an+b where a and b are integers and n is a variable that starts at zero and goes as high as the total number of elements that match your selection. To select the even elements using an equation, use 2n+0. Going back to the argument equation an+b, if a is zero you can drop everything except for b. So instead of writing :nth-child(0n+3) you&#8217;d write :nth-child(3) which would select an element that is the third child of its parent. :nth-child(n+1) is equivalent to  :nth-child(n) and selects every element. Omitting b in the an+b equation selects every a<sup>th</sup> element. :nth-child(4n) selects every fourth element. Negative values are allowed and can be used to select the first X elements. For example, using :nth-child(-n+5) would select elements 5, 4, 3, 2, and 1.</td>
<td>:nth-child(10n+5) selects the 5th, 15th, 25th etc elements td:nth-child(3n)<br />
{ background:gray; } selects the third table cell in every row</td>
</tr>
<tr>
<td><strong>:nth-last-child()</strong></td>
<td>Similar to :nth-child(), this selector operates on the end of a group of elements. It follow the same an+b format and also accepts &#8216;odd&#8217; and &#8216;even&#8217;. :nth-last-child starts at the end of a group of elements and works its way to the top. Where :nth-child(-n+3) would select the first three matching items, :nth-last-child(-n+3) would select the last three.</td>
<td>:nth-last-child(-n+2) selects the last two elements</td>
</tr>
<tr>
<td><strong>:nth-last-of-type()</strong></td>
<td>Another selector where the W3C lost touch with reality when describing it (&#8220;<em>The :nth-of-type(an+b) pseudo-class notation represents an element that has an+b-1 siblings with the same expanded element name before it in the document tree, for any zero or positive integer value of n, and has a parent element.</em>&#8220;). Basically this matches elements based on their type starting with the last elements and working up the list. Similar to :nth-last-child() except instead of selecting the nth child of a parent element you&#8217;re now selecting the nth child element of a specific type.</td>
<td></td>
</tr>
<tr>
<td><strong>:nth-of-type</strong></td>
<td>Similar to :nth-child() selector however instead of selecting the nth child of some parent element you&#8217;re now selecting the nth child element of a specific type (e.g. image). For example, if you had a div that contained 10 paragraphs and 20 images you could use this selector to target just the images and then style specific images a certain way.</td>
<td>img:nth-of-type(2n+1) { float: right; }</td>
</tr>
<tr>
<td><strong>:only-child</strong></td>
<td>Selects elements that have a parent where the parent has no other children. Equivalent to :first-child:last-child or :nth-child(1):nth-last-child(1). Differs from :first-child in that :first-child applies to a parent element with multiple children where :only-child only applies to a parent with one child.</td>
<td>li:only-child works on a list with only one item. if the list had more than one item nothing would be selected.</td>
</tr>
<tr>
<td><strong>:only-of-type</strong></td>
<td>Selects elements that have a parent where the parent has no other children of the same type. Equivalent to :first-of-type:last-of-type or :nth-of-type(1):nth-last-of-type(1).</td>
<td>p &gt; img:only-of-type would select an image within a paragraph only if that paragraph contained no other images.</td>
</tr>
<tr>
<td><strong>:root</strong></td>
<td>Selects the root element of the document. Typically &lt;html&gt;</td>
<td></td>
</tr>
<tr>
<td><strong>:target</strong></td>
<td>Selects elements that are target. In your document you can reference the id of an element or named anchors (e.g. &lt;a name=&#8221;foo&#8221;&gt; or &lt;p id=&#8221;foo&#8221;&gt;). Then when you have a URL that references an id or named anchor (e.g. example.html#foo), the style will be applied. Without the #whatever applied to the URL, the styling won&#8217;t occur. See <a href="http://www.catchmyfame.com/2009/08/01/the-css3-target-pseudo-class-selector/">here</a> for an example.</td>
<td></td>
</tr>
<tr>
<td>:visited</td>
<td>Usually applied to links</td>
<td></td>
</tr>
</tbody>
</table>
<p>Now while that table may seem a little intimidating, it really isn&#8217;t. In fact there are some cool uses for the new CSS3 selectors which we&#8217;ll go into in a future post. One last note, while some of you might be thinking that you can also use a JavaScript library, like jQuery, to accomplish some of the same results in terms of selecting specific elements, which is true, the best part is with some of these new selectors there&#8217;s no need to increase the loading time of your page by including a library when it can now be done with pure CSS.</p>
<h3>Pseudo-elements</h3>
<p>The list of pseudo-elements in CSS3 is the same as in CSS2 &#8212; no changes here. However the syntax has changed a little. By one extra colon to be exact. A pseudo-element is now composed of two colons (::) followed by the name of the pseudo-element instead of a single colon. The new :: notation is introduced to establish a discrimination between pseudo-classes and pseudo-elements. For backward compatibility, browsers must also accept the previous one-colon notation for pseudo-elements introduced in CSS 1 and 2 (e.g :first-line, :first-letter, :before and :after).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.catchmyfame.com/2010/05/01/a-guide-to-css2-and-css3-pseudo-classes-and-pseudo-elements/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Narrow Minded</title>
		<link>http://www.catchmyfame.com/2010/03/01/narrow-minded/</link>
		<comments>http://www.catchmyfame.com/2010/03/01/narrow-minded/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 02:42:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript/jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.catchmyfame.com/?p=492</guid>
		<description><![CDATA[Recently I was checking out some code written many years ago by another developer, and as I was hacking it up to be re-used, I started wondering why he had decided to split up his lines of code so that they were very narrow. Comments, for example, that were a few sentences long ended up [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was checking out some code written many years ago by another developer, and as I was hacking it up to be re-used, I started wondering why he had decided to split up his lines of code so that they were very narrow. Comments, for example, that were a few sentences long ended up spanning nearly a dozen lines when they could easily exist on just a couple of lines. It was then that I noticed that he had been wrapping his text at 80 columns – in other words, each line contained no more than 80 characters. It&#8217;s been a long time since I forced myself to wrap code at 80 columns, either because what I had written was concise to begin with, or because no one else would be looking at the code and it just didn&#8217;t matter, and I had almost forgotten why people did this in the first place.</p>
<p>I’ve seen code wrapped at 80 columns plenty of times before, but something about picking apart this code at that moment made me suddenly ask why. What was so special about this 80 column “standard” and why was it seen throughout the programming world? When I first started out coding this was just assumed to be the way to do things but I had never fully heard an explanation as for why this was done.</p>
<p>As it turns out the answer lies in old technology and tradition. In the early days of coding,  text based terminal displays were only 80 characters wide, so any lines longer than 80 characters needed to be wrapped. There just wasn’t any choice in the matter. Remember that GUIs and mice didn’t exist back then and scrolling was typically done only vertically. Some people believe that the even older computing method of using punch cards, which also typically had 80 columns, is the reason for this style of coding, however while it may have influenced the design of those old terminals, I don’t believe that punch cards directly gave way to practice of coding text at 80 columns.</p>
<p>Now since virtually no one uses an old terminal to write code, and today’s monitors are larger and have larger display resolution than older machines, why do we still see this? The answer? Tradition. Well that and readability. While most modern code editors will let you type a single line for as long as you want, reading that line becomes a huge pain in the ass. You’re forced to scroll horizontally to the right to read the code or comment, and then scroll back to the left to get back to the rest of the code. While an 80 column limit might seem constrictive or limiting, it actually makes code easier to read, and can help you write better code by making you find ways to shrink your code down to fit in one line. Another advantage to limiting the characters per line is code comparison. By staying with the 80 column rule you can usually fit two files side by side and examine them line by line quite easily.</p>
<p>Oh and while 80 columns is sort of a standard, 72 and 76 column layout are also quite common, but slightly more restrictive. Personally I am lazier than I like to admit and I often don’t pay a load of attention to how many columns each line of my code takes up. But that’s being both a bit lazy and selfish. By making your code readable, it helps you and anyone else looking at it&#8230;and you just know you’re going to need another set of eyes looking at your code at some point to help ferret out a bug down the line. And while I’m no advocate for 80 columns, if you stick with a layout that makes your code easy to read why not pick something like 100, 120, or 132 columns now that most people have larger monitors? Being lazy I also don’t think that any of this should be a rule but more of a suggestion or guideline. Bottom line, once you get your code to work the way you want it to, why not make it look good and improve the readability at the same time?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.catchmyfame.com/2010/03/01/narrow-minded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Week In Review: iPads, Chrome, Firefox, and PayPal</title>
		<link>http://www.catchmyfame.com/2010/01/28/the-week-in-review-ipads-chrome-firefox-and-paypal/</link>
		<comments>http://www.catchmyfame.com/2010/01/28/the-week-in-review-ipads-chrome-firefox-and-paypal/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 16:55:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.catchmyfame.com/?p=465</guid>
		<description><![CDATA[Wow, what a week. For a web developer/designer/tech lover there has been a lot of new information in this first month of 2010 (at last we get to use the word &#8220;twenty&#8221; to describe the new decade &#8212; twenty-oh-four never rolled off the tongue). Not only did two of the best browsers get some nice [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, what a week. For a web developer/designer/tech lover there has been a lot of new information in this first month of 2010 (at last we get to use the word &#8220;twenty&#8221; to describe the new decade &#8212; twenty-oh-four never rolled off the tongue). Not only did two of the best browsers get some nice updates, but Apple finally released their long-rumored tablet and Microsoft told users to stop using IE6. Oh, and then there&#8217;s PayPal.</p>
<h3>Firefox and Chrome</h3>
<p>First off, Mozilla and Google both released updates to their web browsers. Firefox 3.6 is out now, and in addition to some bug fixes it introduces eye candy known as &#8220;personas&#8221;, stale plugin protection, downloadable web font (WOFF)  support, support for new CSS attributes such as gradients, background sizing,  and pointer events, and support for new DOM and HTML5 specifications including the drag &amp; drop and file API, which allow for more interactive  web pages.</p>
<p>Google released the fourth version of their Chrome browser which added the ability to add extensions and sync bookmarks across multiple computers.  They also have added more HTML 5 support including   LocalStorage, Database API, WebSockets, and more. I like Chrome, but I still haven&#8217;t switched to using it as my primary browser (still Firefox). I think it&#8217;s making good strides but for the time being I still use it  mostly for testing. I like it, don&#8217;t get me wrong, it&#8217;s just that Firefox and I are old friends and well, I don&#8217;t see a need to dump Firefox just yet.</p>
<h3>The <span style="text-decoration: line-through;">iTablet</span> <span style="text-decoration: line-through;">iSlate</span> iPad</h3>
<p>Just yesterday Apple released their long awaited tabled, the iPad. Almost instantly the jokes about the name iPad began to circulate around the Internet with no end in sight. I admit I also cringed at the name, and was hoping for something more inventive than iPad. While Apple&#8217;s iWhatever line is certainly good branding, it&#8217;s wearing thin on me and it&#8217;s inevitable that at some point they&#8217;ll need to come up with a better solution.<span id="more-465"></span></p>
<p>Name aside, I, like many others, was a bit let down by the product that Apple released. Granted, with all the hype and rumors swirling around the tablet, it was virtually unavoidable that no matter what Apple released that it wouldn&#8217;t be as amazing as everyone had dreamed it would. A lot of reports call the iPad just a big iPhone with no camera (or ability to make calls) and since I don&#8217;t own an iPhone (can&#8217;t stand AT&amp;T and don&#8217;t want to endure the raping they call data charges) I guess I&#8217;ll have to take their word for it. Personally I think I&#8217;ll wait until the next generation of iPads comes out before I plunk down $500+ for one. It looks like a decent start, but it has a ways to go before I see it as the &#8220;magical&#8221; and &#8220;revolutionary&#8221; product that Steve says it is.</p>
<h3>Stop Using IE6</h3>
<p>It&#8217;s no surprise to those of you that read CatchMyFame that I don&#8217;t support IE6 at all. If anything I create works in iE6, it&#8217;s by accident. Not only have big names like YouTube announced that they will be ending support of IE6, even <a href="http://blogs.zdnet.com/Bott/?p=1645">Microsoft announced that it&#8217;s probably a good thing to upgrade</a> to a more recent browser. The fact that IE6 is still alive and kicking amazes me, though I am well aware of the arguments for using it &#8211; primarily ignorance and sloth.</p>
<h3>HTML5 and CSS3</h3>
<p>I&#8217;m happy to see increasing support for <a href="http://dev.w3.org/html5/spec/Overview.html">HTML5</a> and <a href="http://www.w3.org/Style/CSS/current-work#table">CSS3</a>, however I haven&#8217;t jumped on the bandwagon just yet. There are some really great features in these updates, however the sad fact is that until all the major browsers support the features, we&#8217;re forced to find workarounds and create special conditions to account for those features that don&#8217;t exist yet, or aren&#8217;t fully implemented, in the major browsers. Like rounded corners? I do, but since some browsers don&#8217;t understand the border-radius rule, you either need to generate a solution for those browsers that don&#8217;t get it (&lt;cough&gt;IE8&lt;/cough&gt;) or ignore it and let those visitors that use browsers without CSS3 support see squared cornered.</p>
<p>So the dilemma is, do we forge ahead and learn HTML5 and CSS3 now, or do we wait until there&#8217;s mass support for it and most users will benefit from it? Personally I&#8217;m in the first camp and think we should learn as much about it as possible and implement it when its most accessible and least problematic. I also think that if more developers start using HTML5 and CSS3 that it will force browser developers to come out with updates for the features more quickly.</p>
<h3>PayPal &#8211; Love it or Hate it?</h3>
<p>I&#8217;ve been a PayPal member for a decade. That said, overall I think it&#8217;s a very good service and for web developers it&#8217;s a great way to be able to accept payments online. It&#8217;s far easier than trying to get a merchant account, a payment gateway and everything else you need to accept credit cards on the web. They offer several services that allow you to integrate their service into your website including something called Instant Payment Notification.</p>
<p>In a nutshell, IPN allows PayPal to send a notification to your server with transaction details whenever you receive a payment. I recently worked with NotOneBit.com to develop a system where my client could sell eBooks online and accept payment with PayPal. PayPal would notify the client&#8217;s server upon receiving payment and the customer would almost instantly be able to download their purchase. The system worked perfectly; customers were able to make purchased quickly and easily and then download the eBooks directly from the website. No fuss, no muss.</p>
<p>However we soon discovered a fatal flaw in PayPal&#8217;s seller protection policy after one customer claimed that their PayPal account had been hacked and someone used their information to make an eBook purchase. You see, PayPal only protects sellers where there are tangible goods that can be tracked, and since my client sold digital goods, they therefore weren&#8217;t protected. My client argued with PayPal that based upon the system that I and NotOneBit designed, that there&#8217;s no way that this claim of a hacked PayPal account could be legitimate (we send download data to the customer&#8217;s email address so this supposed hacker would have also needed to hack  this person&#8217;s  email account in addition to their PayPal account). PayPal didn&#8217;t seem to care and just reiterated their policy, so in the end, my client was out the money for the purchase (which PayPal happily refunded to the person with the supposed hacked accounts) and the eBook. In the end the person got a few free eBooks (and hopefully some bad karma). It&#8217;s really a shame that PayPal caves so easily on a topic like this when if they took a few minutes to understand what we and probably many other developers using their service to help deliver digital goods have done, then they&#8217;d see the obvious fraud.</p>
<p>Caveat venditor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.catchmyfame.com/2010/01/28/the-week-in-review-ipads-chrome-firefox-and-paypal/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The CSS3 Target Pseudo Class Selector</title>
		<link>http://www.catchmyfame.com/2009/08/01/the-css3-target-pseudo-class-selector/</link>
		<comments>http://www.catchmyfame.com/2009/08/01/the-css3-target-pseudo-class-selector/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 21:19:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.catchmyfame.com/?p=195</guid>
		<description><![CDATA[By accident the other day I came across the CSS3 target selector.  If you&#8217;re unfamiliar with what pseudo class selectors are, the W3C defines them thusly: &#8220;The pseudo-class concept is introduced to permit selection based on information that lies outside of the document tree or that cannot be expressed using the other simple selectors. A [...]]]></description>
			<content:encoded><![CDATA[<p>By accident the other day I came across the <a href="http://www.w3.org/TR/css3-selectors/#target-pseudo">CSS3 target selector</a>.  If you&#8217;re unfamiliar with what pseudo class selectors are, the W3C defines them thusly:</p>
<p style="padding-left: 30px;">&#8220;The pseudo-class concept is introduced to permit selection based on information that lies outside of the document tree or that cannot be expressed using the other simple selectors. A pseudo-class always consists of a &#8220;colon&#8221; (:) followed by the name of the pseudo-class and optionally by a value between parentheses.&#8221;</p>
<p>There are several pseudo classes widely in use today, for example the :visited selector which is normally used like:</p>
<pre>a.external:visited</pre>
<p>to specify styling of links that have already been visited by the user.</p>
<p>The target pseudo class selector allows us to style parts of the web page that are targeted by bookmark anchor links. Again, I&#8217;ll use the W3C for an example:</p>
<p style="padding-left: 30px;">&#8220;Some URIs refer to a location within a resource. This kind of URI ends with a &#8220;number sign&#8221; (#) followed by an anchor identifier (called the fragment identifier). URIs with fragment identifiers link to a certain element within the document, known as the target element. For instance, here is a URI pointing to an anchor named section_2 in an HTML document: http://example.com/html/top.html#section_2. A target element can be represented by the :target pseudo-class. If the document&#8217;s URI has no fragment identifier, then the document has no target element.&#8221;</p>
<p>You&#8217;re seen these links since the web began, however now we can apply styling based on the specific bookmark anchor. For example, using the URL in the previous paragraph, we could create a style that was only applied to the bookmark anchor section_2 if the URL contained #section_2. An example helps illustrate what I mean. <strong>Take a look <a href="/downloads/pseudo-target.html" target="_blank">at this page</a>, but don&#8217;t click anything. Feel free to scroll up and down. Nothing special right? Now try clicking one of the links in the page, or go to the page again using <a href="/downloads/pseudo-target.html#two">this link /downloads/pseudo-target.html#two</a>.</strong> Pretty cool. No JavaScript or anything else needed. What happens is that the bookmark anchor you follow gets styling applied to it only when the URL contains the bookmark anchor (e.g. #two, #six, #seven, etc.). The CSS that accomplishes this is:</p>
<pre id="line1">dt:target {
	color:blue;
	background:#EFEFEF;
	border:1px solid #CCCCCC;
	padding:4px 2px;
	-moz-border-radius: 6px;
	-webkit-border-radius: 6px;
}

dt:target + dd {
	padding:4px;
	color:#336;
	background: #FDFDFD;
	border-bottom: 1px dotted #CCCCCC;
	border-right: 1px dotted #CCCCCC;
	border-left: 1px dotted #CCCCCC;
}</pre>
<p>By applying the :target pseudo class selector, we can tell the browser to only style the elements on the page that match the bookmark anchor chosen. Among other things, this allows you to easily style part of a page like a FAQ and highlight the relevant link only when the user has clicked on a bookmark anchor or followed a URL that targets a specific anchor.  How many times have you followed a link that jumps you to a specific part of a long document only to not be sure that you&#8217;re seeing what you expected. This is especially true when bookmark anchor links take you to the bottom of a page when the browser can&#8217;t pull the content up to the very top of the window (i.e. link one versus link 10 in the demo).</p>
<h2>Browser support</h2>
<p>Since the :target pseudo class selector is a CSS3 feature, not all browsers understand it, or implement it fully. Firefox 3.5.1 and Chrome 2.x do a great job. Safari 4 almost gets it all right, and IE8 ignores it completely. Opera 9.64 seems to handle the :target selector alright, but ignores the sibling CSS (dt:target + dd).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.catchmyfame.com/2009/08/01/the-css3-target-pseudo-class-selector/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS Shorthand Cheat Sheet</title>
		<link>http://www.catchmyfame.com/2009/07/30/css-shorthand-cheat-sheet/</link>
		<comments>http://www.catchmyfame.com/2009/07/30/css-shorthand-cheat-sheet/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 14:20:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.catchmyfame.com/?p=182</guid>
		<description><![CDATA[Over the years I&#8217;ve needed a quick reference for CSS shorthand properties for things like font, border, and background. While there are a few decent cheat sheets out there for this, inevitably I end up having to pull them off my wall and read them because they aren&#8217;t clear enough. I finally decided to make [...]]]></description>
			<content:encoded><![CDATA[<p>Over the years I&#8217;ve needed a quick reference for CSS shorthand properties for things like font, border, and background. While there are a few decent cheat sheets out there for this, inevitably I end up having to pull them off my wall and read them because they aren&#8217;t clear enough. I finally decided to make my own and I&#8217;m making it available to anyone who wants it. It&#8217;s a one page PDF which should fit nicely in a wall or binder. It covers the three properties I mentioned above since I find myself using them the most. While it&#8217;s true that there are more CSS properties that can be written in shorthand, I find that they&#8217;re either a) easy to remember (e.g. color:  #123 versus color: #112233) or they&#8217;re infrequently used (e.g. outline?). If you notice any errors please feel free to let me know and I&#8217;ll update the sheet.</p>
<p><a href="http://www.catchmyfame.com/wp-content/uploads/2009/07/CSS-Shorthand-Cheat-Sheet.pdf">CSS Shorthand Cheat Sheet</a> in PDF format, or as a <a href="http://www.catchmyfame.com/wp-content/uploads/2009/07/CSS-Shorthand-Cheat-Sheet.png">PNG image</a>.</p>
<p><a href="http://www.catchmyfame.com/wp-content/uploads/2009/07/CSS-Shorthand-Cheat-Sheet.png" rel="thumbnail"><img class="alignnone size-medium wp-image-185" title="CSS Shorthand Cheat Sheet" src="http://www.catchmyfame.com/wp-content/uploads/2009/07/CSS-Shorthand-Cheat-Sheet-231x300.png" alt="CSS Shorthand Cheat Sheet" width="231" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.catchmyfame.com/2009/07/30/css-shorthand-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Non-Breaking Space &#8211; &#160;</title>
		<link>http://www.catchmyfame.com/2007/10/15/the-non-breaking-space/</link>
		<comments>http://www.catchmyfame.com/2007/10/15/the-non-breaking-space/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 17:05:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.catchmyfame.com/2007/10/15/the-non-breaking-space/</guid>
		<description><![CDATA[This is one of those posts that you never thought you&#8217;d be reading. Spaces, how basic a topic is that? It&#8217;s almost ridiculous. A no-brainer. The &#38;nbsp; is a &#34;HTML character entity&#34; which is just a fancy way of saying it&#8217;s a HTML way of displaying characters that may not appear on your keyboard. The [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of those posts that you never thought you&#8217;d be reading. Spaces, how  basic a topic is that? It&#8217;s almost ridiculous. A no-brainer. The &amp;nbsp; is a &quot;HTML  character entity&quot; which is just a fancy way of saying it&#8217;s a HTML way of displaying  characters that may not appear on your keyboard. The two common ways to access these  special creatures is to use special HTML. For example, if you wanted to show the  cent sign (&cent;) you can enter &amp;#162; or &amp;cent; in your HTML. All character entities  start with a pound sign (#) and end with a semicolon (;). There are plenty of cool  or unusual HTML character entities available out there like the club &clubs; (&amp;#9827;),  the quarter fraction &frac14; (&amp;#188), the infinity symbol &infin; (&amp;#8734;) and many more. Note  that not all HTML character entities are available in every font and every OS, so  sometimes you might get unexpected results, especially with the more obscure characters.</p>
<p>But the space? Why does the space need a special code (&amp;nbsp; or &amp;#160;)? Well  technically &amp;nbsp; and &amp;#160; aren&#8217;t just spaces, they&#8217;re <u>non-breaking</u> spaces.  What&#8217;s so special about that you ask? The difference between &quot;just an average space&quot;  and the &quot;non-breaking space&quot; is that while a typical space between text will allow  the text to be broken up on multiple lines, the non-breaking space does just what  it&#8217;s name implies and prevents the text from breaking. Here&#8217;s a quick example. Let&#8217;s  say you have some text that is being squeezed due to other elements on your page.  So the text &quot;non breaking text&quot; ends up like this:</p>
<div>Example:</p>
<div style="border: 1px solid rgb(153, 153, 153); padding: 4px; width: 50px;">non breaking space</div>
</div>
<p>You can see that the text has been broken up on multiple lines. What happens  if we absolutely need to have the text all on one line and want to prevent the browser  from automatically breaking it? This is where the non-breaking space comes in handy.  By substituting regular spaces with non-breaking ones you get:</p>
<div style="margin-bottom: 40px;">Example:</p>
<div style="border: 1px solid rgb(153, 153, 153); padding: 4px; width: auto; position: absolute;">non breaking space</div>
</div>
<p>This obviously breaks the 50 pixel width we specified, however it does keep the  text from breaking. Now if you&#8217;re like me, you&#8217;ve known about the &amp;nbsp; tag forever  and never given it a second thought. You might also have run into it when looking  at code from other folks or from some HTML editors, especially when people try to  indent things manually like: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Section 1. Older  versions of FrontPage were especially guilty of trying to be overly helpful by using  &amp;nbsp; in places that it didn&#8217;t belong, or when content was pasted into it. Older  versions of Netscape also used to pitch a fit if a table cell was encountered with  no content in it and the easy workaround was to throw a &amp;nbsp; tag in the cell to  appease the browser. Thankfully most of today&#8217;s better HTML editors know when to  properly apply the &amp;nbsp; tag and now so do you.</p>
<p>Note: Also check out the &lt;nobr&gt; tag (which was never a formal part of any HTML  standard) and CSS nowrap attribute.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.catchmyfame.com/2007/10/15/the-non-breaking-space/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Leader Dots with CSS</title>
		<link>http://www.catchmyfame.com/2007/06/02/leader-dots-with-css/</link>
		<comments>http://www.catchmyfame.com/2007/06/02/leader-dots-with-css/#comments</comments>
		<pubDate>Sun, 03 Jun 2007 04:03:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.catchmyfame.com/2007/06/02/leader-dots-with-css/</guid>
		<description><![CDATA[You&#8217;re probably asking yourself, &#8220;What are leader dots?&#8221;. Whenever I design forms, I&#8217;ve always felt that the text labels should either be left justified and lined up next to the form fields they correspond to, or directly above them. It&#8217;s just one of those things. Even when presenting data that is suited to form or [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;re probably asking yourself, &#8220;What are leader dots?&#8221;. Whenever I design forms, I&#8217;ve always felt that the text labels should either be left justified and lined up next to the form fields they correspond to, or directly above them. It&#8217;s just one of those things. Even when presenting data that is suited to form or tabular data where the name of a field and the contents are both to be displayed, I can&#8217;t accept seeing the fields another way, particularly right justified so they but up against the data, or data entry fields.<span id="more-8"></span></p>
<p>For example, take this example of a typical form:<br />
<a title="example 1" rel="thumbnail" href="http://www.catchmyfame.com/images/leader_dots_form1.gif"><img title="example 1" src="http://www.catchmyfame.com/images/leader_dots_form1.gif" border="1" alt="example 1" width="241" height="184" /></a></p>
<p>Nothing wrong there, except that if just one of the field labels, in this case the initial password text, is longer than the other fields, the space between the other fields and their associated labels also becomes very large and you end up with this visual dead space. Of course, you could force the text to wrap by either breaking it up with markup or by imposing a width on the table cells, like this:<br />
<a title="example 2" rel="thumbnail" href="http://www.catchmyfame.com/images/leader_dots_form2.gif"><img title="example 2" src="http://www.catchmyfame.com/images/leader_dots_form2.gif" border="1" alt="example 2" width="236" height="244" /></a></p>
<p>Again visually this is undesirable because of the opposite reason &#8212; instead of empty dead space we&#8217;re crowding text together in too little space. My least favorite option is bumping the text over to be next to the field that it belongs to, like this:<br />
<a title="example 3" rel="thumbnail" href="http://www.catchmyfame.com/images/leader_dots_form3.gif"><img title="example 3" src="http://www.catchmyfame.com/images/leader_dots_form3.gif" border="1" alt="example 3" width="236" height="180" /></a></p>
<p>Technically there is nothing wrong with this, but visually it&#8217;s irritating. It&#8217;s almost like reading movie credits where there are two columns, the left one right justified and the right one left justified. My eyes don&#8217;t follow the flow of word logically and odds are my visitors are the same.</p>
<p>My solution? Borrow a page from the print world and use leading dots. Leading dots are those dots you often see in a table of contents where the space between the text and the page number is filled in with small dots. My problem was how to come up with a simple system and make it pass validation at the same time. After some trial and error I came up with a simple CSS solution that does the trick nicely. Here&#8217;s a quick example:</p>
<p><a title="example 4" rel="thumbnail" href="http://www.catchmyfame.com/images/leader_dots_form4.gif"><img title="example 4" src="http://www.catchmyfame.com/images/leader_dots_form4.gif" border="1" alt="example 4" width="228" height="173" /></a></p>
<p>How is this done? Basically field label is wrapped in a div which has a small image of a dot applied repeatedly in the x direction as a background. This alone would cause the dots to flow under the text so to nullify that effect, the text itself is then wrapped in a span where the background color is set to match the color of the background of the containing element. Here is the CSS:</p>
<p><code>.dots {<br />
background:url('dot.gif') repeat-x bottom;<br />
}<br />
.field {<br />
background-color: #FFFFFF;<br />
}</code><br />
To apply this to the example form, you would just use it as: <code>&lt;td&gt;&lt;div class="dots"&gt;&lt;span class="field"&gt;Last Name&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;</code></p>
<p>This method could even be applied to displaying the data from a form or database like so:<a title="example 5" rel="thumbnail" href="http://www.catchmyfame.com/images/leader_dots_form5.gif"><img title="example 5" src="http://www.catchmyfame.com/images/leader_dots_form5.gif" border="1" alt="example 5" width="245" height="144" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.catchmyfame.com/2007/06/02/leader-dots-with-css/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

