<?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>David Kendall &#187; Coding snippets</title>
	<atom:link href="http://www.davidfreelance.co.uk/index.php/category/website-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidfreelance.co.uk</link>
	<description>Web developer and dog enthusiast</description>
	<lastBuildDate>Mon, 07 Sep 2009 11:04:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Force vertical scrollbar on all browsers</title>
		<link>http://www.davidfreelance.co.uk/index.php/2009/09/07/force-vertical-scrollbar-on-all-browsers/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2009/09/07/force-vertical-scrollbar-on-all-browsers/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 11:04:06 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/?p=50</guid>
		<description><![CDATA[There is a definate trend emerging towards having a website centered horizontally on the page. Not a problem for many using the margin: auto css (remember though to assign a width to the element being centered otherwise margin: auto won`t work) but there is a slight pecadillo that messes this up slightly, the scrollbar on [...]]]></description>
			<content:encoded><![CDATA[<p>There is a definate trend emerging towards having a website centered horizontally on the page. Not a problem for many using the margin: auto css (remember though to assign a width to the element being centered otherwise margin: auto won`t work) but there is a slight pecadillo that messes this up slightly, the scrollbar on the browser.</p>
<p><span id="more-50"></span></p>
<p>Decent browsers (Firefox, Opera, Safari etc) hide the scrollbar until it is needed which nicely provides a little extra space to play with, but if the next page on the website is quite long and requires a scrollbar or if you use css/javascript to show/hide content the page appears to jump when the srollbar is displayed.</p>
<p>This looks tacky.</p>
<p>I am not a big fan of tacky so looked into a solution to stop this from happening, I envisaged some nasty javascript hack but luckily css has a nifty little answer to the problem.</p>
<pre><code>html {
            overflow-y: scroll;
}
</code></pre>
<p>That tiny piece of css forces a vertical scrollbar on your browser. Unfortunately Opera doesn`t support this but there is an Mozilla alternative</p>
<pre><code>overflow: -moz-scrollbars-vertical</code></pre>
<p>Job done, scrollbars on the page even if the content on the page doesn`t need them. No more nasty jumping around on the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2009/09/07/force-vertical-scrollbar-on-all-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>That niggling extra space beneath an image in a div</title>
		<link>http://www.davidfreelance.co.uk/index.php/2009/04/29/that-niggling-extra-space-beneath-an-image-in-a-div/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2009/04/29/that-niggling-extra-space-beneath-an-image-in-a-div/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 15:47:53 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>
		<category><![CDATA[General stuff]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2009/04/29/that-niggling-extra-space-beneath-an-image-in-a-div/</guid>
		<description><![CDATA[Have you ever had a div where the last thing in there (or even the only thing) is an image? If so you will most likely have found that most browsers puts 3px or so extra space beneath your image.
Here&#8217;s what I mean

Thisis a div which consists of a background image for the blue background, [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever had a div where the last thing in there (or even the only thing) is an image? If so you will most likely have found that most browsers puts 3px or so extra space beneath your image.</p>
<p>Here&#8217;s what I mean</p>
<p><img src="http://www.davidfreelance.co.uk/spacebeneathimage.gif" title="space beneath image in a div" alt="space beneath image in a div" vspace="5" width="178" border="0" height="243" hspace="5" /></p>
<p>Thisis a div which consists of a background image for the blue background, a paragraph for the text and an image of a heart to finish. Ideally I do not want the extra few pixels at the bottom showing my backgroudn through.</p>
<p><em>&lt;div class=&#8217;testimonial&#8217;&gt;<br />
&lt;p&gt;“Thank you so much for your help. I met Bob through the site after less than a month, and we are still together and happy all these months on. Thanks Motorway dating ”<br />
&lt;br /&gt;&lt;br /&gt;<br />
&lt;strong&gt;Katie x&lt;/strong&gt;<br />
&lt;/p&gt;<br />
&lt;img alt=&#8217;Motorway dating testimonial&#8217; src=&#8217;images/testimonial_bottom.gif&#8217; width=&#8217;178&#8242; height=&#8217;76&#8242; /&gt;<br />
&lt;/div&gt; </em></p>
<p>You would think that adding margin: 0px; padding: 0px will sort the problem but nope, nadda.</p>
<p>I tried googling but couldn`t find anything on the subject apart from suggestions of zero margins and paddings despite many people coming across this very annoying problem.</p>
<p>So I put the good old thinking cap on and remembered this nifty little piece of css</p>
<p><em>vertical-align: text-bottom; </em></p>
<p>Hurray! Place this onto your image css</p>
<p><strong><em>.testimonial img {vertical-align: text-bottom;}</em></strong></p>
<p>and voila, no extra space beneath your image. Just to prove it here is what my testimonial looks like now</p>
<p><img src="http://www.davidfreelance.co.uk/spacebeneathimagefixed.gif" title="space beneath image in a div" alt="space beneath image in a div" vspace="5" width="178" border="0" height="239" hspace="5" /></p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2009/04/29/that-niggling-extra-space-beneath-an-image-in-a-div/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>css opacity across all web browsers</title>
		<link>http://www.davidfreelance.co.uk/index.php/2007/11/09/css-opacity-across-all-web-browsers/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2007/11/09/css-opacity-across-all-web-browsers/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 15:00:46 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2007/11/09/css-opacity-across-all-web-browsers/</guid>
		<description><![CDATA[This morning I have been developing a website from a series of .psd files. The designer did something that I haven`t had to code into a website for a very long time, the navigation area had an opacity, a semi transparent layer over an image. My first thought was cross browser compatability to ensure it [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I have been developing a website from a series of .psd files. The designer did something that I haven`t had to code into a website for a very long time, the navigation area had an opacity, a semi transparent layer over an image. My first thought was cross browser compatability to ensure it works in all web browsers<span id="more-44"></span></p>
<p>The last time I put transparency onto a website was back in the days when css was rarely used and was in it&#8217;s infancy.  I remember utilisng a backgroudn image in the transparent area to mimic the idea of opacity, a good workaround that worked a treat. But what happens when the user expands the text size and the containing div is expanded, all goes to cock!</p>
<p>So, I am a few years older, a few more grey hairs on my head (still not receeding though, phew) and css has come on a long way, so have web browses I hope!</p>
<p>At time of writing this post, website opacity is not a w3c recommendation although it has been adopted by the major web browsers.</p>
<p>Mozilla and Firefox have supported css3 opacity since 2004 but our old nemesis IE had not, that is until the recent release of IE 7 .</p>
<p>So lets do it in our website;</p>
<ul>
<li>the css3 standard for setting transparency is <code>opacity: 0.5</code></li>
<li>Mozilla uses <code>-moz-opacity:0.5</code></li>
<li>IE uses their own messed up method of <code>filter:alpha(opacity=50)</code></li>
</ul>
<p><strong>Working example</strong></p>
<p>As ever we need to ensure our website is developed for all web browsers, so in our css lets style for all three variations</p>
<p><code> 	opacity: 0.5;<br />
-moz-opacity:0.5;<br />
filter:alpha(opacity=50);<br />
</code></p>
<p>This sets 50% transparency, just change the values, a lower values makes the layer more transparent. Oh and remember to set a background colour <code>background-color: #ffffff</code> or something to get the true effect of the transparency.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2007/11/09/css-opacity-across-all-web-browsers/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Firefox search bar google bug fix</title>
		<link>http://www.davidfreelance.co.uk/index.php/2007/08/21/firefox-search-bar-google-bug-fix/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2007/08/21/firefox-search-bar-google-bug-fix/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 14:41:14 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>
		<category><![CDATA[General stuff]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2007/08/21/firefox-search-bar-google-bug-fix/</guid>
		<description><![CDATA[A month or so ago Firefox updated itself to version 2.0.0.6, as a result my firefox search bar options have been missing missing google.co.uk. I use the search bar within firefox and am returned with www.google.com results.
I trawled the Firefox website and Googled galore for an answer to this but found bob all, so this [...]]]></description>
			<content:encoded><![CDATA[<p>A month or so ago Firefox updated itself to version 2.0.0.6, as a result my firefox search bar options have been missing missing google.co.uk. I use the search bar within firefox and am returned with www.google.com results.</p>
<p>I trawled the Firefox website and Googled galore for an answer to this but found bob all, so this afternoon fed up of having to manually goto google.co.uk for my searches, I thought I would have a dig around.</p>
<p><span id="more-37"></span></p>
<p><strong>I found the solution!</strong></p>
<p>Ok, if anyone else has this problem (probably not seeing as there is nothing on the web about it at the moment!), just follow these steps to enlightenment;</p>
<p>1. Browse to C:\program files\mozilla firefox\searchplugins<br />
2. Open &#8220;google.xml&#8221; in a text editor such as notepad or wordpad<br />
3. Look for any references of http://www.google.com/<br />
4. Change/edit the &#8220;www.google.com&#8221; to your locale which for me is &#8220;www.google.co.uk&#8221;<br />
5. Save it and close<br />
6. Restart Firefox and test the search bar</p>
<p>Your result should now be from google.co.uk. By the time you read this the bug may have been fixed in the next update but hey, I tried <img src='http://www.davidfreelance.co.uk/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2007/08/21/firefox-search-bar-google-bug-fix/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Set website text size using ems</title>
		<link>http://www.davidfreelance.co.uk/index.php/2007/08/21/set-website-text-size-using-ems/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2007/08/21/set-website-text-size-using-ems/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 13:46:11 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2007/08/21/set-website-text-size-using-ems/</guid>
		<description><![CDATA[Many years ago we used to size text using pixels, we knew where we were with them. Tell a web browser to set the text size at 12px, voila it was done. But then the web grew up, we realised we had to start to change the way we develop websites, accessibility and usability was [...]]]></description>
			<content:encoded><![CDATA[<p>Many years ago we used to size text using pixels, we knew where we were with them. Tell a web browser to set the text size at 12px, voila it was done. But then the web grew up, we realised we had to start to change the way we develop websites, accessibility and usability was key and pixel text sizing just didn`t do the job.</p>
<p><span id="more-36"></span></p>
<p><strong>So what was wrong with pixel text sizing?</strong></p>
<p>Nothing in theory, most web broswers are capable of scaling the text up and down depending on the local browser/operating system settings. Great, lets develop websites towards those &#8211; wrong! The most popular (well, most commonly used) web browser our old friend Internet Explorer cannot scale pixel text size. So what do we have available?</p>
<p><strong>Ems text sizing</strong></p>
<p>Ems was frowned upon back in the day, it had the reputation of being unreliable and a general pain in the ass to use. But on closer inspection it is just as easy as pixels but gives you increased flexibility, lets look at it&#8230;</p>
<p>Most modern browsers default text size is 16px, a little eager on the text sizing methinks. So by default, 1em = 16px. We liked pixel text sizing because it was easy to use, 10px, 12px, 14px etc etc. So lets adapt the browsers default text size in one line of code to make ems text sizing more familiar.</p>
<p>By using the body tag to resize the default text size of 16px, we can then use ems in a much simpler and easier way. lets look at the code first;</p>
<p><code>BODY {font-size:62.5%}</code></p>
<p>So why did we do this? We want to use a base pixel size of 10px for it&#8217;s simplicity, 10px is 62.5% of 16px, hence the line of code above. Now we have set the em text size 1em = 10px for all child elements i.e. everything. You want a paragraph to be 12px, simple we now use 1.2em. A header should be 16px, you get it, we now use 1.6em. Last example, your footer text needs to be 8px, we use 0.8em.</p>
<p><strong>There must be a catch?</strong></p>
<p>Well actually yes there is, although some would argue that this is a great feature os em text sizing. Em text sizing takes it&#8217;s size from it&#8217;s parent element (which is why we placed the 62.% text size declaration within the body css). Lets say we have a content area within our website and we set the text height of this content area to be 1.2em (12px).</p>
<p><code>#CONTENT {font-size: 1.2em}</code></p>
<p>Within this content are we now have a list menu that we want to be slightly larger than the main body text. As the li element will be a child of the #CONTENT div with a text size of 1.2em, we are now working on the basis that 1.0em is now 12px, not the 10px we set via the body tag. So to make the li text size 14px we use 1.2em again.</p>
<p><code>#CONTENT LI {font-size: 1.2em}</code></p>
<p>Similarly, if we wanted the list text to be back down to 10px, we need to use some maths. 1.0em will set the text size as 12px because the parent div sets the text size as 12px using it;s own declaration of 1.2em. To get the size back down to 10px we need to use</p>
<p><code>10 / 12 = 0.8333<br />
</code><br />
So our css looks like this</p>
<p><code>#CONTENT LI {font-size: 0.83em}</code></p>
<p>One more tiny problem, again it is down to the fact that em text sizing takes it&#8217;s value from it&#8217;s parent element. What happens if this list contains another child list? The text within it would be sized at 83.3% of the text above it and so forth for subsequent lists. This is easily corrected however using another simple css tag</p>
<p><code>LI LI {font-size:1em}</code></p>
<p>This will ensure that all child lists are the same size as the parent, you may want to use this technique for other tags within your website such as paragraphs should you nest other tags.</p>
<p><strong>So to conclude</strong></p>
<p>Yes on the surface em text sizing is a little extra work but the benefits by far outweigh the two seconds it will take to add the extra lines of css. Your text can be resized across all browsers and platforms which makes the visitors to your website happy. Give them a go, and why stop at text, size your layers using em, you will never look back to pixels again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2007/08/21/set-website-text-size-using-ems/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Div disappearing in Firefox?</title>
		<link>http://www.davidfreelance.co.uk/index.php/2007/08/10/div-disappearing-in-firefox/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2007/08/10/div-disappearing-in-firefox/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 11:21:23 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2007/08/10/div-disappearing-in-firefox/</guid>
		<description><![CDATA[More and more people are using css on their websites to position text and images, which is a good thing but please check across all web browsers!
In the past week I have come across several websites that display fine in IE but fail in standard compliant web browsers such as Firefox or Opera. One of [...]]]></description>
			<content:encoded><![CDATA[<p>More and more people are using css on their websites to position text and images, which is a good thing but please check across all web browsers!</p>
<p>In the past week I have come across several websites that display fine in IE but fail in standard compliant web browsers such as Firefox or Opera. One of the main problems is the <em>&#8216;null content bug&#8217;</em>.<span id="more-34"></span></p>
<p>Many people use css in their websites to display an image as a background, leaving the div itself empty;</p>
<p><em>&lt;div id=&#8217;advert&#8217;&gt;&lt;/div&gt;</em></p>
<p><em>#advert {position: relative; float: right; width: 20em; <span name="intelliTxt" id="intelliTxt">background: url(background.gif) no-repeat top left;</span>}</em></p>
<p>IE works fine with this, it will take the height of the image and set the height of the div to that of the image, however standard compliant web browsers look at the content within the div to ascertain the height. As in the example above the div is empty so collapses to 0 height.  This means that the entire div including the background image is effectively invisible.</p>
<p><strong>The solution</strong></p>
<p>This is a simple one but one that catches many an experienced web developer out, add the height attribute to your css. Just by adding say height: 10em will give all web browsers a set height of the div and display correctly as you intended.</p>
<p><strong>The morale</strong></p>
<p>Always check your website in as many web browsers as possible, al web developers should do this as standard course.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2007/08/10/div-disappearing-in-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speed up your css development</title>
		<link>http://www.davidfreelance.co.uk/index.php/2007/07/24/speed-up-your-css-development/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2007/07/24/speed-up-your-css-development/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 13:39:18 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2007/07/24/speed-up-your-css-development/</guid>
		<description><![CDATA[Everyone by now should be using css to style their websites, if you are still using tables for your layouts, may you be strung up by your short and curly&#8217;s and flogged until you promise never to use tables again!
I am all for speeding up my development processes and today I found a nifty little [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone by now should be using css to style their websites, if you are still using tables for your layouts, may you be strung up by your short and curly&#8217;s and flogged until you promise never to use tables again!<span id="more-29"></span></p>
<p>I am all for speeding up my development processes and today I found a nifty little tool in the <a href="http://chrispederick.com/work/web-developer/" title="Firefox web developer plugin">Firefox Web Developer plugin</a>. If you don`t klnow what this it, it is a toolbar that sits in Firefox allowing you to do wonderful things to websites, such as check validation, remove all images, highlight layers etc. The list goes on.</p>
<p>I have been using the plugin for several years now but only today did I notice the <strong>edit css</strong> function. Open up a website in Firefox, I have been playing with my localhost website setup. I now want to play with the css of the website and make some changes.</p>
<p>In the Web Developer Plugin toolbar, select the <em>css</em> tab then <em>edit css</em>. Beneath your website a window appears containing the website&#8217;s css file. You can make a change to this and see the change in realtime.</p>
<p>Right, I hear some people asking what is so hard in saving the css file, opening your browser and pressing refresh but my God, this feature of the Web Developer toolbar is genious! Over the course of a few hours, making small tweaks and checking the output on your website it saves time and you never leave your css file.</p>
<p>The only problem is, I have been playing around with this and ended up wasting a lot of time as I have been opening up some websites I developed previously and destrying the css. Call me a geek but that&#8217;s loads of fun!</p>
<p>Chris Pederick who created the Web Developer toolbar has a blog where he writes about new releases, <a href="http://chrispederick.com/blog/" title="Web Developer plugin" target="_blank">view his blog here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2007/07/24/speed-up-your-css-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The easiest possible print this page script ever</title>
		<link>http://www.davidfreelance.co.uk/index.php/2007/07/23/the-easiest-possible-print-this-page-script-ever/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2007/07/23/the-easiest-possible-print-this-page-script-ever/#comments</comments>
		<pubDate>Mon, 23 Jul 2007 13:58:00 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2007/07/23/the-easiest-possible-print-this-page-script-ever/</guid>
		<description><![CDATA[On a daily basis I stumble across many websites with a &#8216;print this page&#8217; feature. Some use complex javascript to strip out images and certain content, others make a call to the database for simply the content text and others maintain seperate files made purely for printing!
What a lot of hard work just to print [...]]]></description>
			<content:encoded><![CDATA[<p>On a daily basis I stumble across many websites with a &#8216;print this page&#8217; feature. Some use complex javascript to strip out images and certain content, others make a call to the database for simply the content text and others maintain seperate files made purely for printing!<span id="more-28"></span></p>
<p>What a lot of hard work just to print a website! I can create a print this page script in one line of code, using my old favourite, css.</p>
<p>The layout of websites often aren`t print friendly, especially for older printers with set margins available to them. On the web we can use an abundance of images and colours which agai throw a printer into a panic.</p>
<p>So, up steps the web superhero, css. When a web browser views a page it looks for a stylesheet, something like this;</p>
<p><em>&lt;link rel=&#8217;StyleSheet&#8217; type=&#8217;text/css&#8217; href=&#8217;/css/mystylesheet.css&#8217; media=&#8217;screen&#8217; /&gt;</em></p>
<p>The key part of this is the media=&#8217;screen&#8217;. As a browser looks at a stylesheet designed specifically for display on a monitor (screen) it also looks for one when you try to print. So when you press print, if the browser finds a stylesheet telling it how the page should print, it will use it. OK, less of the waffle, here&#8217;s how to tell a website browser how to print the page;</p>
<p><em>&lt;link rel=&#8217;StyleSheet&#8217; type=&#8217;text/css&#8217; href=&#8217;/css/mystylesheet.css&#8217; media=&#8217;print&#8217; /&gt;</em></p>
<p>It is really as easy as that. All you have to do to create the most effective print this page script is to build another stylesheet specifically for printing.</p>
<p>So what are the common things to specify in a print stylesheet? You will want as much contract as possible so you may wish to set the page page background to white and the font colour to black.</p>
<p><em>body { background: #ffffff; color: #000000; }</em></p>
<p>Strip out navigation and only print content</p>
<p><em>#navigation { display: none; }</em></p>
<p>Or you may also wish to remove all images</p>
<p><em>img { display: none; }</em></p>
<p>You have all css commands at your disposal to tweak your website to print exactly how your users will want it. This is great for your users if they need to print your website and requires no complex javascript or extra maintenance.</p>
<p>Give it a go and have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2007/07/23/the-easiest-possible-print-this-page-script-ever/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Image method to fix IE fieldset background bug</title>
		<link>http://www.davidfreelance.co.uk/index.php/2007/07/19/image-method-to-fix-ie-fieldset-background-bug/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2007/07/19/image-method-to-fix-ie-fieldset-background-bug/#comments</comments>
		<pubDate>Thu, 19 Jul 2007 15:08:01 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2007/07/19/image-method-to-fix-ie-fieldset-background-bug/</guid>
		<description><![CDATA[Back to previous page
We know by now that IE has a problem displaying a fieldset background colour or image incorrectly. The colour is bled out and overspills into the legend tag. But we don`t want our websites to look scratty, so lets fix it.
You can use css here or continue for the image based mathod.
The [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.davidfreelance.co.uk/index.php/2007/07/19/forcing-fieldset-backgrounds-to-work-in-ie/" title="fieldset background bug display IE">Back to previous page</a></p>
<p>We know by now that IE has a problem displaying a fieldset background colour or image incorrectly. The colour is bled out and overspills into the legend tag. But we don`t want our websites to look scratty, so lets fix it.<span id="more-26"></span></p>
<p><a href="http://www.davidfreelance.co.uk/index.php/2007/07/19/css-method-of-fixing-ie-to-display-fieldset-background-correctly/" title="fieldset background bug display IE css">You can use css here</a> or continue for the image based mathod.</p>
<p>The image method is quite simple really. Typically IE renders the fieldset background 8 pixels above the top of the fieldset. We can set a background image or even a single colour background image with an 8px header built up of transparent pixels.</p>
<p>&lt;a href=&#8221;http://img255.imageshack.us/my.php?image=fieldsetbackgroundwg8.gif&#8221; target=&#8221;_blank&#8221;&gt;&lt;img src=&#8221;http://img255.imageshack.us/img255/2502/fieldsetbackgroundwg8.th.gif&#8221; border=&#8221;0&#8243; alt=&#8221;Free Image Hosting at www.ImageShack.us&#8221; /&gt;&lt;/a&gt;</p>
<p>See what I mean. Adding the 8px of transparent pixels still leaves us with the same problem of the background image overlapping the legend tag however now we just can`t see it.</p>
<p>Simple really  <img src='http://www.davidfreelance.co.uk/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2007/07/19/image-method-to-fix-ie-fieldset-background-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>css method of fixing IE to display fieldset background correctly</title>
		<link>http://www.davidfreelance.co.uk/index.php/2007/07/19/css-method-of-fixing-ie-to-display-fieldset-background-correctly/</link>
		<comments>http://www.davidfreelance.co.uk/index.php/2007/07/19/css-method-of-fixing-ie-to-display-fieldset-background-correctly/#comments</comments>
		<pubDate>Thu, 19 Jul 2007 14:59:39 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding snippets]]></category>

		<guid isPermaLink="false">http://www.davidfreelance.co.uk/index.php/2007/07/19/css-method-of-fixing-ie-to-display-fieldset-background-correctly/</guid>
		<description><![CDATA[Back to previous page
The problem IE faces when rendering fieldset background is that it applies the fieldset background to the legend, as well as the fieldset itself.
The solution to this is to seperate the fieldset from the legend. Here&#8217;s how I do it, you may be able to figure out another method but this one [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.davidfreelance.co.uk/index.php/2007/07/19/forcing-fieldset-backgrounds-to-work-in-ie/" title="fieldset background bug display IE">Back to previous page</a></p>
<p>The problem IE faces when rendering fieldset background is that it applies the fieldset background to the legend, as well as the fieldset itself.</p>
<p>The solution to this is to seperate the fieldset from the legend. Here&#8217;s how I do it, you may be able to figure out another method but this one works perfectly fine for me;<span id="more-25"></span></p>
<p>We disassociate the legend from the fieldset we need to absolutely position it, so lets apply <em>position: absolute</em> to the legend css. Rememebr though this absolute positioning needs to be relative to it&#8217;s parent element (the fieldset) to prevent it from being positioned at 0,0 (top left) of the page. To do this we relative position the fieldset using <em>position: relative</em>.</p>
<p>OK, so now we have the legend and fieldset as seperate. Try it out. You will notice that because we used absolute positioning the legend is at 0,0 to the fieldset, so lets make it look like a legend should do and move it over to the right and little and up a bit. You should now have something like this</p>
<p>fieldset {position: relative;}<br />
legend {position: absolute; top: -5em; left: 5em;}</p>
<p>Adding a background color to the fieldset will now only fill in the fieldset and will display correctly in all web browsers! You might want to play around a little with margins and padding of the fieldset and legend to create your own unique layout.</p>
<p>Didn`t like the css method, try the image method instead</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidfreelance.co.uk/index.php/2007/07/19/css-method-of-fixing-ie-to-display-fieldset-background-correctly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
