<?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>Paul Bennett - User Interface Developer &#187; XHTML</title>
	<atom:link href="http://pmbennett.net/tag/xhtml/feed/" rel="self" type="application/rss+xml" />
	<link>http://pmbennett.net</link>
	<description></description>
	<lastBuildDate>Thu, 27 Oct 2011 15:10:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting Started with TypeKit</title>
		<link>http://pmbennett.net/2009/10/14/getting-started-with-typekit/</link>
		<comments>http://pmbennett.net/2009/10/14/getting-started-with-typekit/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 18:15:54 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://pmbennett.net/articles/?p=86</guid>
		<description><![CDATA[I finally got my invite to <a href="http://typekit.com">TypeKit</a> today! I had to wait for an invite from a friend in the end. I must say, I see it as a great resource for the future.]]></description>
			<content:encoded><![CDATA[<p>I say that because until a large enough percentage of the population have moved over to a browser that supports @font-face, I doubt I will use it for any of the projects I am involved in.</p>
<p>I am a big fan of progressive enhancement, but a lot of clients still use IE6, and trying to tell them that they will only get the nice design and typography if they upgrade their browser just isn&#8217;t a realistic option. This is why I see it as a useful resource for the future. There is also the issue of reliability. Even the biggest and best sites have down time every now and then. Trying to explain this &#8220;bug&#8221; to a client will be a right pain.</p>
<p>On a positive note, this is a step in the right direction when it comes to using fonts legally on a website. It will help keep designers happy, as they will be able to use all the nice fonts and it will keep the font creators themselves happy, as they will get the credit and return they deserve.</p>
<p>It should also be said that the service is incredibly easy to use. Sign-up, choose your fonts, set your CSS hooks and copy-and-paste the supplied Javascript into the head of your HTML document. That is literally it! </p>
<p>I wait with eagerness for the first release of <a href="http://fontdeck.com">Font Deck</a> to see how it compares to TypeKit!</p>
]]></content:encoded>
			<wfw:commentRss>http://pmbennett.net/2009/10/14/getting-started-with-typekit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Bar Chart with jQuery</title>
		<link>http://pmbennett.net/2009/08/20/css-bar-chart-with-jquery/</link>
		<comments>http://pmbennett.net/2009/08/20/css-bar-chart-with-jquery/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 15:12:00 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://pmbennett.net/articles/?p=75</guid>
		<description><![CDATA[I saw a flash bar chart the other day, which had a nice animation and looked very nice, and wondered if it would be possible to achieve a similar effect using just XHTML, CSS and a little bit of jQuery.]]></description>
			<content:encoded><![CDATA[<h4>Step 1: The Markup</h4>
<p>I started with a simple ordered list, which contained the text values which would represent the height of each bar on the chart. there are wrapped in a span which we will require in order to style this correctly in the CSS. </p>
<pre><code>&lt;div id="chart"&gt;
&lt;ol&gt;
	&lt;li id="green_bar"&gt;<span>450</span>&lt;/li&gt;
	&lt;li id="yellow_bar"&gt;<span>600</span>&lt;/li&gt;
	&lt;li id="red_bar"&gt;<span>300</span>&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</code></pre>
<h4>Step 2: The <abbr title="Cascading Style sheets">CSS</abbr></h4>
<p>I then used some background images to create the graph and the 3D bars. The CSS specifies how high each bar should be and adds the background images. (This can be quite tricky as it requires a little bit of arithmetic to ensure that the bar is the correct height and the scales are consistent).</p>
<pre><code>#chart {
	background: #FFF url('../images/chart_bg.png') no-repeat 0 0;
	width: 636px;
	height: 420px;
}
#chart ol {
	margin: 0;
	padding: 0;
	list-style-type: none;
	position: relative;
	height: 420px;
	width: 636px;
	overflow: hidden;
}
#chart ol li {
	text-indent: -9999em;
	width: 140px;
	position: absolute;
	bottom: 0;
	background-repeat: no-repeat;
	background-position: -140px 0;
	background-color: transparent;
	padding: 38px 0 0 0;
}
#green_bar {
	height: 150px;
	background-image: url('../images/green_bar_top.png');
	left: 80px;
}
#green_bar span {
	background: transparent url('../images/green_bar.png') no-repeat left bottom;
	display: block;
	height: 150px;
}
#yellow_bar {
	height: 200px;
	background-image: url('../images/yellow_bar_top.png');
	left: 260px;
}
#yellow_bar span {
	background: transparent url('../images/yellow_bar.png') no-repeat left bottom;
	display: block;
	height: 200px;
}
#red_bar {
	height: 100px;
	background-image: url('../images/red_bar_top.png');
	left: 440px;
}
#red_bar span {
	background: transparent url('../images/red_bar.png') no-repeat left bottom;
	display: block;
	height: 100px;
}</code></pre>
<h4>Step 3: Adding some jQuery animation</h4>
<p>At this point we have a fairly nice looking three dimensional graph using only CSS and some markup: now to add the animation! All we need to do is position the bars below the x-axis using jQuery, and then add the animation that will slide them in. It&#8217;s pretty simple, but looks pretty nice. It does have it&#8217;s drawbacks, as the height of the highest bar needs to be known so that the chart background image can be created. Any dynamic graphs that are created on-the-fly will be difficult to create, but for one-off static graphs, this is a neat little effect.</p>
<pre><code>$(function() {
  // hide the bars to begin with
	$('#chart ol li').each(function() {
		$(this).css({'bottom': '-' + $(this).height() + 'px'});
		$(this).css({'background-position': '0 0'});
	});
  // animate the bars position to show on the graph
	$('&lt;p&gt;<a href="#">Show_results</a>&lt;/p&gt;').click(function() {
		$('#chart ol li').each(function() {
			$(this)
			.css({'background-position': '-140px 0'})
			.animate({
				bottom: '0px'
			}, 500);
		});
		return false;
	}).appendTo('body');
});</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://pmbennett.net/2009/08/20/css-bar-chart-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fading Navigation Text with CSS &amp; jQuery</title>
		<link>http://pmbennett.net/2009/08/02/fading-navigation-text-with-css-jquery/</link>
		<comments>http://pmbennett.net/2009/08/02/fading-navigation-text-with-css-jquery/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 19:37:49 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://pmbennett.net/articles/?p=63</guid>
		<description><![CDATA[It's been a while since the last post, mainly because I haven't had anything to post about. However, recently, I wanted to achieve a fading effect when I hovered on the navigation elements of a website I was making. I could have just used jQuery to animate the color of the text using the <a href="http://plugins.jquery.com/project/color">color plugin</a> and that would be the end of it. Unfortunately, the designer used a non-standard font for the navigation, so I needed an alternative approach.]]></description>
			<content:encoded><![CDATA[<p>So I remembered reading <a href="http://snook.ca/archives/javascript/jquery-bg-image-animations/">an article by Jonathon Snook</a> and knew that I could do something similar to achieve this effect. So my approach was to use an image for each navigation element, which had the text cut out of it.</p>
<h4>Step 1: The Markup</h4>
<p><img class="f_left" src="/demos/images/illustration.png" alt="Illustration of how this technique works" />As with any navigation menu, I have started off with a simple list. Each list item needs a link inside it, and each of these links needs a span inside it. The span is required so that we can add the transparent cut-out text image on-top of the gradient background colour. Additionally, I have given each list item an id, as we need these hooks for the CSS and jQuery animation.</p>
<pre><code>&lt;ol&gt;
  &lt;li id="home"&gt;<a href="#"><span>home</span></a>&lt;/li&gt;
  &lt;li id="about"&gt;<a href="#"><span>about</span></a>&lt;/li&gt;
  &lt;li id="blog"&gt;<a href="#"><span>blog</span></a>&lt;/li&gt;
  &lt;li id="contact"&gt;<a href="#"><span>contact</span></a>&lt;/li&gt;
&lt;/ol&gt;</code></pre>
<h4>Step 2: The <abbr title="Cascading Style Sheets">CSS</a></h4>
<p>The CSS is actually straight forward: firstly, we add the gradient background image to the link, and then add the cut-out text image to the span nested inside of it. You will notice I have used the <a href="http://www.twinhelix.com/css/iepngfix/">iepngfix</a> hack to get the transparencies working in IE6 (Although without further workarounds, I believe the link won&#8217;t be clickable&#8230;meh!). I have included a hover state for these links, so that without Javascript, the color will still change, you just won&#8217;t get the fading animation.</p>
<pre><code>#navigation ol li {
	list-style-type: none;
	padding: 0;
	margin: 0;
	color: #FFF;
	width: 141px;
	float: left;
	padding: 0;
	height: 54px;
}
#navigation ol li a {
	text-decoration: none;
	display: block;
	width: 100%;
	height: 54px;
	padding: 0;
	margin: 0;
	color: #FFF;
	text-indent: -9999em;
	background-color: #FFF;
	background-position: 0 0;
	background-repeat: repeat-x;
	background-image: url('../images/nav_gradient.png');
}
#navigation ol li a:hover {
	background-position: 0 -162px;
}
#navigation ol li a span {
	display: block;
	background-color: transparent;
	background-repeat: no-repeat;
	background-position: 0 0;
	height: 54px;
	width: 100%;
	behavior: url('../js/iepngfix.htc');
}
#navigation ol li#home a span {
	background-image: url('../images/home_tab.png');
}
#navigation ol li#about a span {
	background-image: url('../images/about_tab.png');
}
#navigation ol li#blog a span {
	background-image: url('../images/blog_tab.png');
}
#navigation ol li#contact a span {
	background-image: url('../images/contact_tab.png');
	width: 141px;
}</code></pre>
<h4>Step 3: The jQuery Animation</h4>
<p>This is incredibly simple: all you need to do is define a hover function for each link, and then animate the background position when the mouse is moved over and out of the link. <strong>Note: </strong>In order to get background animations to work, you will need to download and include the <a href="http://plugins.jquery.com/project/backgroundPosition-Effect">background position plugin</a>.</p>
<pre><code>$(function() {
	$('#navigation ol li a')
	.css({backgroundPosition: '0 0'})
	.hover(
		function () {
			$(this).stop().animate(
				{backgroundPosition: '(0 -162px)'},
				{duration: 500}
			);
		},
		function () {
			$(this).stop().animate(
				{backgroundPosition: '(0 0)'},
				{duration: 400}
			);
		}
	);
});</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://pmbennett.net/2009/08/02/fading-navigation-text-with-css-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Polls</title>
		<link>http://pmbennett.net/2009/06/07/css-polls/</link>
		<comments>http://pmbennett.net/2009/06/07/css-polls/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 10:49:18 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://pmbennett.net/articles/?p=43</guid>
		<description><![CDATA[A number of websites I have been involved in recently have required a poll, where users can vote and see the overall results in the form of a graph. In this post, I will describe my approach to this.]]></description>
			<content:encoded><![CDATA[<p>Firstly, we have the XHTML markup. I have chosen to use an ordered list, with some additional markup to provide enough hooks for the CSS:</p>
<pre><code>&lt;ol&gt;
 &lt;li&gt;
  <strong><em style="width: 54%;">54%</em></strong>
  <span>Option 1</span>
 &lt;/li&gt;
 &lt;li&gt;
  <strong><em style="width: 22%;">22%</em></strong>
  <span>Option 2</span>
 &lt;/li&gt;
 &lt;li&gt;
  <strong><em style="width: 14%;">14%</em></strong>
  <span>Option 3</span>
 &lt;/li&gt;
 &lt;li class="last"&gt;
  <strong><em style="width: 10%;">10%</em></strong>
  <span>Option 4</span>
 &lt;/li&gt;
&lt;/ol&gt;</code></pre>
<p>Now that we have enough hooks, we can apply our style to achieve this graphical representation of the poll results. These pages are generated by a CMS, and the percentage values are variables populated for a database. Therefore, to achieve this, inline styles are needed to set the graph bars to the appropriate widths. It is a bit annoying that you can&#8217;t completely separate the presentation from the mark-up, but I think it is a small price to pay, for a nice effect.</p>
<pre><code>#pollWrapper {
 width: 800px;
 padding: 1em 0;
 overflow: hidden;
 height: auto;
}

#pollWrapper ol {
 list-style-type: none;
 margin: 0;
 padding: 2px;
 position: relative;
 border: 1px solid #CCC;
}

#pollWrapper ol li {
 overflow: hidden;   /* clear floats in modern browsers */
 zoom: 1;    /* clear floats in IE6 - put in external stylesheet */
 font-size: 0.75em;
 margin: 0 0 2px 0;
}

#pollWrapper ol li.last {
 margin: 0;
}

#pollWrapper ol li strong {
 width: 200px;
 margin-right: 10px;
 padding: 1px;
 float: left;
 display: inline;
 background: #FAFAFA;
}

#pollWrapper ol li em {
 display: block;
 background: #CCC;
 color: #333;
 text-indent: 2px;
}

#pollWrapper ol li span {
 width: 582px;
 float: left;
}</code></pre>
<p class="articleLinks"><a href="/articles/demos/css-polls.html" target="_blank">View demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pmbennett.net/2009/06/07/css-polls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote linking with a twist</title>
		<link>http://pmbennett.net/2009/06/04/remote-linking-with-a-twist/</link>
		<comments>http://pmbennett.net/2009/06/04/remote-linking-with-a-twist/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 19:46:08 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://pmbennett.net/articles/?p=14</guid>
		<description><![CDATA[Recently, I came across a scenario where a client wanted a list of links which would link to certain areas of the site. Additionally, they wanted to add a roll-over effect, where an image would change depending what link the mouse was hovering over. Without giving it a thought, I initially began to write some jQuery to do the trick, which would have been fine; but then I came across <a href="http://css-tricks.com/remote-linking/">Chris Coyier's remote linking article</a>, and thought that I could build upon this to provide me with a CSS only solution.]]></description>
			<content:encoded><![CDATA[<p>There isn&#8217;t too much to this: it makes use of positioning and z-index to achieve this. Firstly we have the mark-up, which basically embeds each image, with the link text inside the anchor itself:</p>
<pre><code>&amp;lt;ol&amp;gt;
    &amp;lt;li&amp;gt;
        &amp;lt;a id="red"&amp;gt;Red Square
            &amp;lt;img src="images/red_square.png" alt="Red Square" /&amp;gt;
        &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;
        &amp;lt;a id="yellow"&amp;gt;Yellow Circle
            &amp;lt;img src="images/yellow_circle.png" alt="Yellow Square" /&amp;gt;
        &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;
        &amp;lt;a id="green"&amp;gt;Green Triangle
            &amp;lt;img src="images/green_triangle.png" alt="Green Triangle" /&amp;gt;
        &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;
        &amp;lt;a id="blue"&amp;gt;Blue Hexagon
            &amp;lt;img src="images/blue_hexagon.png" alt="Blue Hexagon" /&amp;gt;
        &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;/ol&amp;gt;</code></pre>
<p>And the CSS, where the magic happens:</p>
<pre><code>#linksWrapper ol {
	list-style-type: none;
	margin: 0;
	padding: 0;
	position: relative;
}
#linksWrapper ol li {
	width: 180px;
}
#linksWrapper ol li a {
	text-decoration: none;
	padding: 0.25em 10px;
	display: block;
	color: #000;
	width: 160px;
}
#linksWrapper ol li a img {
	position: absolute;
	top: 0;
	left: 180px;
	z-index: 100;
	border: none;
}
#linksWrapper ol li a#red img {
	z-index: 500;
}
#linksWrapper ol li a#yellow:hover {
	background-color: #FFFC00;
	color: #000;
}
#linksWrapper ol li a#red:hover {
	background-color: #FF0000;
	color: #FFF;
}
#linksWrapper ol li a#green:hover {
	background-color: #24EA44;
	color: #FFF;
}
#linksWrapper ol li a#blue:hover {
	background-color: #2B99F6;
	color: #FFF;
}
#linksWrapper ol li a:hover img {
	z-index: 1000;
}</code></pre>
<p class="articleLinks"><a target="_blank" href="/demos/remote-linking-with-a-twist.html">View demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pmbennett.net/2009/06/04/remote-linking-with-a-twist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

