 <?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>Broken Links &#187; Basics</title>
	<atom:link href="http://www.broken-links.com/category/basics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.broken-links.com</link>
	<description>Thoughts on web development and technologies by Peter Gasston</description>
	<lastBuildDate>Fri, 30 Jul 2010 00:10:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<atom:link rel='hub' href='http://www.broken-links.com/?pushpress=hub'/>
		<item>
		<title>The importance of semantics on the web</title>
		<link>http://www.broken-links.com/2010/03/03/the-importance-of-semantics-on-the-web/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-importance-of-semantics-on-the-web</link>
		<comments>http://www.broken-links.com/2010/03/03/the-importance-of-semantics-on-the-web/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 10:14:44 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[aboutness]]></category>
		<category><![CDATA[findability]]></category>
		<category><![CDATA[semantic web]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=690</guid>
		<description><![CDATA[We, as website makers, quite often advise our clients to avoid generic link text (read more,click here, etc.), and explain that more verbose descriptions help give context to users with screen readers. But using semantic link descriptions actually helps everyone.

I recently read Peter Morville's fantastic book, <a href="http://books.google.com/books?id=xJNLJXXbhusC">Ambient Findability</a>, which defined really well the motivation to use semantic descriptions for links: they give the target page <a href="http://en.wikipedia.org/wiki/Aboutness">aboutness</a>.]]></description>
			<content:encoded><![CDATA[<p>We, as website makers, quite often advise our clients to avoid generic link text (read more,click here, etc.), and explain that more verbose descriptions help give context to users with screen readers. But using semantic link descriptions actually helps everyone.</p>
<p>I recently read Peter Morville’s fantastic book, <a href="http://books.google.com/books?id=xJNLJXXbhusC">Ambient Findability</a>, which defined really well the motivation to use semantic descriptions for links: they give the target page <a href="http://en.wikipedia.org/wiki/Aboutness">aboutness</a>.</p>
<p><span id="more-690"></span></p>
<p>Simply defined, <strong>aboutness</strong> is the quality of meaning; what something is about is defined by its aboutness. To extend an example from Morville’s book, let’s regard a web page which contains W.H. Auden’s poem, <a href="http://www.davidpbrown.co.uk/poetry/wystan-hugh-auden.html">Funeral Blues</a>:</p>
<blockquote><p>
He was my North, my South, my East and West,<br />
My working week and my Sunday rest,<br />
My noon, my midnight, my talk, my song,<br />
I thought that love would last forever; I was wrong
</p></blockquote>
<p>Although <em>we</em> know that the poem is about death, the word itself doesn’t appear in the poem; so how could a search engine that indexed the page know what it was about, and return it in the results of a search on that topic?</p>
<p>In order to gain some context, the search engine will look at the text of the links to that page*; so a link with the text ‘read more’ will provide no context whatsoever, whereas a link with the text ‘W.H. Auden’s poem about death’ provides aboutness.</p>
<p>And it’s not just for our link text that semantics are important; the same principle applies with HTML — your markup gives aboutness to your content. So if you’re a front-end coder, be sure to at least use appropriate container elements (the <a href="http://html5doctor.com/">HTML5 Doctor</a> can help with this), and if you want to go further take a look at the likes of <a href="http://microformats.org/">Microformats</a> and <a href="http://www.w3.org/TR/xhtml-rdfa-primer/">RDFa</a>.</p>
<p>* Search engines look at more than this, of course, but this is the most obvious example.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2010/03/03/the-importance-of-semantics-on-the-web/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Checking for installed fonts with @font-face and local()</title>
		<link>http://www.broken-links.com/2009/06/30/checking-for-installed-fonts-with-font-face-and-local/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=checking-for-installed-fonts-with-font-face-and-local</link>
		<comments>http://www.broken-links.com/2009/06/30/checking-for-installed-fonts-with-font-face-and-local/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 11:49:35 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[font-face]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=431</guid>
		<description><![CDATA[Firefox 3.5 was released earlier today, and joins Safari in supporting the @font-face rule with OpenType and TrueType font families, allowing you to use a wider range of fonts in your designs (as long as they are correctly licensed, of course).

One slight drawback of the technique is the blank space that's displayed as the new font is loaded into the browser; this is especially unnecessary for users who already have that font natively on their system.]]></description>
			<content:encoded><![CDATA[<p>Firefox 3.5 was released earlier today, and joins Safari in supporting the <a href="http://www.w3.org/TR/css3-fonts/#font-resources">@font-face</a> rule with OpenType and TrueType font families, allowing you to use a wider range of fonts in your designs (as long as they are correctly licensed, of course).</p>
<p>One slight drawback of the technique is the blank space that’s displayed as the new font is loaded into the browser; this is especially unnecessary for users who already have that font natively on their system.</p>
<p>The way to get around that is quite simple; use <code>local()</code> to check if the font is on the user’s system first.</p>
<p><span id="more-431"></span></p>
<p>The syntax is:</p>
<pre>@font-face {
font-family: 'Graublau Sans Web';
src:
    local('Graublau Web'),
    local('GraublauWeb-Regular'),
    url('GraublauWeb.otf');
}</pre>
<p>You’ll notice there are two calls to <code>local()</code>; the first is for the full name, the second for the Postscript name; this is required for Safari in OS X.</p>
<p>The cascade is used so that only if the first two conditions aren’t met (that is, the font is not on the user’s system) will the third come into play, loading the font into the browser’s cache. This won’t get rid of the blank space, of course, but it will reduce the number of users who see it.</p>
<p id="graublau">Here’s an example paragraph which will display in the excellent <a href="http://nicewebtype.com/fonts/graublau-sans-web/">Graublau Sans Web</a> family mentioned above — as long as you have a browser which supports the feature. </p>
<p>Don’t forget, you will need to declare the rule for each face (bold, italic, etc) in the font family. There’s a good introduction to the whole topic at <a href="http://hacks.mozilla.org/2009/06/beautiful-fonts-with-font-face/">Beautiful Fonts With @font-face</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2009/06/30/checking-for-installed-fonts-with-font-face-and-local/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Quick testing for console.log</title>
		<link>http://www.broken-links.com/2009/02/04/quick-testing-for-consolelog/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=quick-testing-for-consolelog</link>
		<comments>http://www.broken-links.com/2009/02/04/quick-testing-for-consolelog/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 23:50:28 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=332</guid>
		<description><![CDATA[I'm happy to see that <a href="http://blogs.msdn.com/ie/archive/2008/09/09/what-s-new-for-jscript-for-ie8-beta-2.aspx">IE8 includes native support for console.log</a>, the JavaScript command which writes information to your preferred debugging tool (mine is <a href="http://getfirebug.com/">Firebug</a>). If you leave it in your code &#8211; as I did on my latest project &#8211; it throws an error in IE7 &#038; below.]]></description>
			<content:encoded><![CDATA[<p>I’m happy to see that <a href="http://blogs.msdn.com/ie/archive/2008/09/09/what-s-new-for-jscript-for-ie8-beta-2.aspx">IE8 includes native support for console.log</a>, the JavaScript command which writes information to your preferred debugging tool (mine is <a href="http://getfirebug.com/">Firebug</a>). If you leave it in your code – as I did on my latest project – it throws an error in IE7 &amp; below.</p>
<p>The way around it is to quickly check that the command is supported by your browser, and to provide an alternative (I use that old standby, <code>alert</code>) if not; and the quickest way to do that is with the <a href="http://javascriptant.com/articles/28/the-conditional-operator-ternary-operactor"><code>if…else</code> shorthand</a>:</p>
<pre>window.console ? console.log(foo) : alert(foo);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2009/02/04/quick-testing-for-consolelog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom markup for Microformats</title>
		<link>http://www.broken-links.com/2009/02/03/custom-markup-for-microformats/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=custom-markup-for-microformats</link>
		<comments>http://www.broken-links.com/2009/02/03/custom-markup-for-microformats/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 00:06:02 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[hcard]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[microformats]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=326</guid>
		<description><![CDATA[A mistake which seems to be fairly common when taking the first steps in learning about <a href="http://microformats.org/">Microformats</a> (and one which I have made) is to presume that the markup which is generated by the generation tools &#8211; for example, the <a href="http://microformats.org/code/hcard/creator">hCard Creator</a> &#8211; is the  markup that must be used in the page.]]></description>
			<content:encoded><![CDATA[<p>A mistake which seems to be fairly common when taking the first steps in learning about <a href="http://microformats.org/">Microformats</a> (and one which I have made) is to presume that the markup which is generated by the generation tools – for example, the <a href="http://microformats.org/code/hcard/creator">hCard Creator</a> – is the  markup that must be used in the page.</p>
<p>That’s not the case, of course; with a few notable exceptions, the markup is completely customisable, and it is the order of the class names (and other attributes) which matters.</p>
<p><span id="more-326"></span></p>
<p>As a quick example, here’s what the hCard Creator outputs (minus the promotional sentence) when I enter my name and email address:</p>
<pre>&lt;div id="hcard-Peter-Gasston" class="vcard"&gt;
&lt;span class="fn"&gt;Peter Gasston&lt;/span&gt;
&lt;a class="email" href="mailto:peter@broken-links.com"&gt;peter@broken-links.com&lt;/a&gt;
&lt;/div&gt;</pre>
<p>This could just as easily (and correctly) be marked up like this:</p>
<pre>&lt;p id="hcard-Peter-Gasston" class="vcard"&gt;
&lt;strong class="fn"&gt;
&lt;a class="email" href="mailto:peter@broken-links.com"&gt;Peter Gasston&lt;/a&gt;
&lt;/strong&gt;
&lt;/p&gt;</pre>
<p>Or like this:</p>
<pre>&lt;ul id="hcard-Peter-Gasston" class="vcard"&gt;
&lt;li&gt;&lt;em class="fn"&gt;Peter Gasston&lt;/em&gt;
 (&lt;a class="email" href="mailto:peter@broken-links.com"&gt;email&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>All the examples conform to the <a href="http://microformats.org/wiki/hcard">hCard specification</a>, but in each case the markup is customised to better resolve a particular coding requirement. </p>
<p>It’s really worth taking a look through the <a href="http://microformats.org/wiki/">Microformats Wiki</a> and spending a little time with the specifications in order to see the fundamental requirements of each, and to find out how much leeway you have in marking up your data.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2009/02/03/custom-markup-for-microformats/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Grid alignment without frameworks</title>
		<link>http://www.broken-links.com/2008/06/10/aligning-to-grids-without-a-framework/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=aligning-to-grids-without-a-framework</link>
		<comments>http://www.broken-links.com/2008/06/10/aligning-to-grids-without-a-framework/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 22:33:39 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[technique]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=162</guid>
		<description><![CDATA[When building a small site or blog template with a grid-based layout I find 'CSS frameworks' such as <a href="http://code.google.com/p/blueprintcss/">Blueprint</a> and <a href="http://developer.yahoo.com/yui/grids/">YUI Grids</a> are overkill; they contain a lot of extra CSS rules which I don't use. They are (in the vernacular) like using a sledgehammer to crack a nut.]]></description>
			<content:encoded><![CDATA[<p>When building a small site or blog template with a grid-based layout I find ‘CSS frameworks’ such as <a href="http://code.google.com/p/blueprintcss/">Blueprint</a> and <a href="http://developer.yahoo.com/yui/grids/">YUI Grids</a> are overkill; they contain a lot of extra CSS rules which I don’t use. They are (in the vernacular) like using a sledgehammer to crack a nut.</p>
<p>What I do instead is much simpler; I use an extra stylesheet just for testing, and a single PNG image tiled across the background.</p>
<p><span id="more-162"></span></p>
<p>The PNG is in a reverse ‘L’ shape with a coloured area representing the gutter between columns, and the white area the column width. Here’s one I made earlier:</p>
<p><img src="/wp-content/uploads/2008/06/grid_65-10.png" alt="Grid tile" /></p>
<p>I call the tiled image from a stylesheet I usually call ‘testing.css’, which has just a handful of rules:</p>
<pre>body {
background-image: url('grid.png');
margin: 0;
}

div { background-color: transparent; }</pre>
<p>Obviously the exact rules are up to you, but the idea is to align the site over to the left, tile the grid image across the whole page, and make all the structural elements transparent so you can see the site overlaid onto the grid and make any necessary code changes. <a href="http://www.broken-links.com/wp-content/uploads/2008/06/grid_layout.png">This image shows an example of this in action</a>.</p>
<p>So as you add new elements to the site you can quickly drop a <code>link</code> to testing.css in with the rest of your stylesheets to test the alignment, then remove it (or comment it out) when you want to proceed with the rest of the build. This is a quick and easy way to get your site laid out to the optimal alignment to a grid without using a framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2008/06/10/aligning-to-grids-without-a-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Explaining the C in CSS</title>
		<link>http://www.broken-links.com/2008/02/19/explaining-the-c-in-css/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=explaining-the-c-in-css</link>
		<comments>http://www.broken-links.com/2008/02/19/explaining-the-c-in-css/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 23:26:33 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/2008/02/19/explaining-the-c-in-css/</guid>
		<description><![CDATA[After being a developer for a while you sometimes forget that there are a lot of people still learning. With that in mind — and working on the assumption that the more information that’s available, the easier it is to find — I’ve decided to start an occasional series of web development basics tutorials. One [...]]]></description>
			<content:encoded><![CDATA[<p><em>After being a developer for a while you sometimes forget that there are a lot of people still learning. With that in mind — and working on the assumption that the more information that’s available, the easier it is to find — I’ve decided to start an occasional series of web development basics tutorials.</em></p>
<p>One of the things I see a few people struggle with when learning CSS is the concept of <a href="http://www.w3.org/TR/CSS21/cascade.html#cascade">the cascade</a>. I admit that as your stylesheets get more and more complicated, so the cascade gains in complexity with it. At it’s core, however, it’s pretty simple. There are three things you need to keep in mind: order, specificity, and inheritance.</p>
<p><span id="more-84"></span></p>
<h5>Order</h5>
<p>In a nutshell: if two declarations are applied to the same element, the values of the declaration which come later in the document flow (which I shall refer to as the ‘most recent’) are applied. Here’s an example:</p>
<pre>h1 { color: red; }
h1 { color: blue; }</pre>
<p>In this case, the <code>h1</code> element will be colored blue, because that declaration is the most recent in the stylesheet.</p>
<p>Obviously this will be affected by whether a style is external (or embedded) or inline — inline styles always win because they are more recent than styles in the head. Also, this rule only applies when declarations have an equal specificity; see below for an explanation of this.</p>
<h5>Specificity</h5>
<p>Declarations can be weighted to change the order. This weighting depends on which selector (or chain of selectors) is used to apply rules to it. Andy Clarke put together <a href="http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html">a specificity table using Star Wars characters</a> which explains the rules in detail, but at it’s most basic it’s this: id selectors overrule class selectors, which in turn overrule element selectors.</p>
<p>Say for example you have this markup:</p>
<pre>&lt;h1 class="title" id="page-title"&gt;</pre>
<p>And these rules in your stylesheet:</p>
<pre>h1 { color: red; }
#page-title { color: green; }
.title { color: blue; }</pre>
<p>The colour of the <code>h1</code> would be green, because even though the class selector is more recent, id selectors have a higher specificity.</p>
<h5>Inheritance</h5>
<p>You can probably guess this from the title; child elements inherit values from their parents (in most cases). Say for example I have my <code>h1</code> element in the page again, and the following rule in my stylesheet:</p>
<pre>body { color: red; }</pre>
<p>My <code>h1</code> element would display in red also, as it inherits the value from it’s parent — the <code>body</code>. As I mentioned before, that doesn’t happen in every case; links, for example, don’t inherit colours from their parent element. A little trial and error should let you know what is and isn’t inherited.</p>
<h5>Summary</h5>
<p>Although this has been a very quick run-through and can’t hope to show every facet of the cascade, I hope someone reading this gets some use out of it and it helps them fix some troublesome behaviour!</p>
<ul>
<li><a href="http://www.jemjabella.co.uk/post/20070623_css_using_the_cascade">CSS: Using the cascade</a></li>
<li><a href="http://reference.sitepoint.com/css/cascade">Sitepoint CSS Reference: The Cascade</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2008/02/19/explaining-the-c-in-css/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
