<?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>Dave Woods Freelance Web Designer UK &#187; HTML</title>
	<atom:link href="http://www.dave-woods.co.uk/index.php/category/blog/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dave-woods.co.uk</link>
	<description></description>
	<lastBuildDate>Fri, 09 Dec 2011 11:26:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Using em&#8217;s for font sizing</title>
		<link>http://www.dave-woods.co.uk/index.php/using-ems-for-font-sizing/</link>
		<comments>http://www.dave-woods.co.uk/index.php/using-ems-for-font-sizing/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 20:45:50 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/?p=693</guid>
		<description><![CDATA[Many web designers still use pixels for sizing their fonts within a web page, however this presents an accessibility problem on devices and browsers (namely Internet Explorer) which don&#8217;t allow pixels to be resized. The solution is to use ems or percentages to size the font so that they&#8217;re relative to the base font size [...]]]></description>
			<content:encoded><![CDATA[<p>Many web designers still use pixels for sizing their fonts within a web page, however this presents an accessibility problem on devices and browsers (namely Internet Explorer) which don&#8217;t allow pixels to be resized. The solution is to use ems or percentages to size the font so that they&#8217;re relative to the base font size set within the browser and it&#8217;s really not as difficult as a lot of people might think.</p>
<p><span id="more-693"></span></p>
<h2>What is an em?</h2>
<p>Firstly for anyone that hasn&#8217;t used ems before, here&#8217;s the definition:</p>
<blockquote><p>An em is a unit of measurement in the field of typography. This unit defines the proportion of the letter width and height with respect to the point size of the current font. Originally the unit was derived from the width of the capital &#8220;M&#8221; in a particular typeface. This unit is not defined in terms of any specific typeface, and thus is the same for all fonts at a given point size. So, 1 em in a 16 point typeface is 16 points.</p></blockquote>
<h2>Using ems to set the font size</h2>
<p>There&#8217;s many ways that you can use ems. Personally, I prefer to set the font size so that all HTML elements within the page are consistent and use 10px throughout a website using the following code:</p>
<p><code>body, select, input, textarea {<br />
font: 0.625em/1.4 tahoma, verdana, arial, helvetica, sans-serif;<br />
}</code></p>
<p>This is just the starting point though to reset the font size to a consistent level. The 1.4 sets the line-height and following on from that is the font-family which will change depending on the project but the one thing that is consistent is the 0.625em regardless of the website I&#8217;m working with.</p>
<p>By doing this, it allows me to easily set font sizes for other elements and containers within the site. For example, if I want to set a font size to 12px then I can do so by declaring an em size of 1.2em; If I want 9px, then it&#8217;s 0.9em and so on.</p>
<p>As you can see from the following CSS code, creating font sizes using em values is actually just as easy as using pixels but with the advantage that they can scale regardless of the device or web browser being used:</p>
<p><code>#navigation {<br />
	font-size: 1.4em;<br />
}<br />
h1 {<br />
	font-size: 2.4em;<br />
}<br />
#content {<br />
	font-size: 1.2em;<br />
}</code></p>
<h2>What about inheriting ems</h2>
<p>This causes the biggest confusion for a lot of web designers and is why a lot of people revert back to using pixels. Take the following example:</p>
<p><code>#content {<br />
	font-size: 1.2em;<br />
}<br />
#content p {<br />
	font-size: 1.1em;<br />
}</code></p>
<p>Now, a lot of people might expect that the paragraph would display at 11px given what I explained earlier. However, ems are inherited and therefore the initial 10px would render at 12px due to the #content font value but then assuming that the paragraph is nested within the #content element, it would then be scaled to 1.1em of it&#8217;s initial value and would therefore actually appear larger than 12px.</p>
<p>In order to get around this I use the following chart: <a href="http://aloestudios.com/tools/emchart/">http://aloestudios.com/tools/emchart/</a> to determine which em size I need to use in order to inherit the correct font size.</p>
<p>So in the above example, you&#8217;d need to use the following:</p>
<p><code>#content {<br />
	font-size: 1.2em;<br />
}<br />
#content p {<br />
	font-size: 0.917em; /* this will render at 11px */<br />
}</code></p>
<h2>Summary</h2>
<p>Using ems can take a little getting used to but if you want to create accessible font sizes then it really is the best solution and once you&#8217;ve got the hang of how ems are inherited they&#8217;re a powerful tool.</p>
<p>You can even create truly flexible websites by using ems for entire layouts so that they scale with the users default font setting but I&#8217;ll save that tutorial for another time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/using-ems-for-font-sizing/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>7 Common Mistakes When Using the HTML Heading Element</title>
		<link>http://www.dave-woods.co.uk/index.php/7-common-mistakes-when-using-the-html-heading-element/</link>
		<comments>http://www.dave-woods.co.uk/index.php/7-common-mistakes-when-using-the-html-heading-element/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 11:47:02 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/index.php/7-common-mistakes-when-using-the-html-heading-element/</guid>
		<description><![CDATA[The heading element is an important part of any HTML document but is misused in a lot of websites. When used correctly it adds semantic meaning, helps with accessibility and can boost your search engine rankings however when used wrongly it can cause problems for your users and search engine rankings. This article explains how [...]]]></description>
			<content:encoded><![CDATA[<p>The heading element is an important part of any HTML document but is misused in a lot of websites. When used correctly it adds semantic meaning, helps with accessibility and can boost your search engine rankings however when used wrongly it can cause problems for your users and search engine rankings. This article explains how heading tags are often misused and how this can be put right.</p>
<p><span id="more-246"></span></p>
<h2>1. Using Multiple h1&#8242;s on the same page</h2>
<p>The &lt;h1&gt; tag should be used to markup your heading for the current page and should come at the top of your main piece of content. If you have a document which contains information about Lions in Africa then it would make sense to use your h1 with that text within the element:</p>
<p><code>&lt;h1&gt;Lions in Africa&lt;/h1&gt;</code></p>
<p>If you then had another piece of content which went into detail about Zebras in Africa then you should have a separate document with that text  as the &lt;h1&gt;</p>
<p>In a situation where you&#8217;re only briefly touching on each subject and there wouldn&#8217;t be enough content to justify breaking it into separate pages then it would make more sense to have a document structure like this:</p>
<p><code>&lt;h1&gt;Wildlife in Africa&lt;/h1&gt;<br />
&lt;h2&gt;Lions in Africa&lt;/h2&gt;<br />
&lt;p&gt;Content about lions in africa&lt;/p&gt;<br />
&lt;h2&gt;Zebras in Africa&lt;/h2&gt;<br />
&lt;p&gt;Content about zebras in Africa&lt;/p&gt;</code></p>
<h2>2. Using the same h1 on every page</h2>
<p>Quite often you&#8217;ll see websites markup their logo or site title with an &lt;h1&gt; tag. In fact the wordpress theme I&#8217;m using for this very blog also makes that mistake (I&#8217;m in the process of building a bespoke one which uses headings correctly).The problem with this is that it doesn&#8217;t offer users or search engines anything unique as the main heading and would be the same as marking each chapter in a book with the book title rather than something easy to differentiate between each page of the site.</p>
<p>A logo or site title should not be used as the main h1 as this should be reserved for the heading for the actual content but this is a mistake I see regularly and can easily be fixed by ensuring the h1 element is only used to markup the beginning of the main content.</p>
<h2>3. Using the heading tag because it matches the font size</h2>
<p>This is a common mistake for newbies to web design but is something that I still see from time to time. Web designers who don&#8217;t understand CSS properly will sometimes avoid using a particular heading because it doesn&#8217;t match the appearance that they&#8217;re looking for in their design. Quite often this will be because an h1 is too big for what they want so they might use an h2 or h3.</p>
<p>However, by using CSS it&#8217;s easy to style the headings to look however we want so the font size should never be considered when deciding which is the correct heading to use. Which moves us on to the next point nicely&#8230;</p>
<h2>4. Not using a heading structure</h2>
<p>Headings should all follow a clear structure so, an h2 should follow an h1 , an h3 should follow an h2 and so on. This is closely linked to the previous point as I&#8217;m sure that this is misused most when people forget that they can easily change the size of the heading with CSS.</p>
<p>For example, the following is a good heading structure:</p>
<ul>
<li>&lt;h1&gt;Wildlife in Africa&lt;/h1&gt;
<ul>
<li>&lt;h2&gt;Lions in Africa&lt;/h2&gt;
<ul>
<li>&lt;h3&gt;A Lions Diet&lt;/h3&gt;</li>
<li>&lt;h3&gt;Lions Characteristics&lt;/h3&gt;</li>
</ul>
</li>
</ul>
<ul>
<li>&lt;h2&gt;Zebras in Africa&lt;/h2&gt;
<ul>
<li>&lt;h3&gt;A Zebras Diet&lt;/h3&gt;</li>
<li>&lt;h3&gt;Zebra Characteristics&lt;/h3&gt;</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>As you can see from the above example, each subheading follows on from the previous heading. I find it useful to imagine the heading structure in the same way as you would a contents page in a book.</p>
<h2>5. Not using heading tags at all</h2>
<p>I&#8217;ve also seen the opposite happen on webpages, whereby instead of a web developer misusing the heading tags, they simply don&#8217;t include any at all.</p>
<p>This is quite often the case when a web designer doesn&#8217;t understand the purpose of the heading element but this is an easy problem to fix. All content should be headed up with an h1 tag so adding that to the beginning of the content is a great start.</p>
<p>I&#8217;d then also look to break the content into sections. Good content usually follows a theme and explains one point before moving on to the next so if possible I&#8217;d always try to introduce h2&#8242;s as a minimum and quite often h3&#8242;s. For long blocks of content I&#8217;d also look to break this down further with h4&#8242;s and so on but in most cases it isn&#8217;t usually required so whatever suits your content best.</p>
<h2>6. Using the heading tag for non-heading content</h2>
<p>I&#8217;ve seen this used on different occasions, sometimes by accident where newbie&#8217;s use it for making content bold or because it matches the style they&#8217;re after but I&#8217;ve also seen this where designers are deliberately trying to trick search engines into using the words placed within the heading element to rank their page.</p>
<p>The heading tag does help to rank web pages and is one of the main things on a web page that you can use to add emphasis to keywords and phrases. However trying to manipulate the search engines in this way will only have a negative impact as they&#8217;ll either dish out a penalty for over abusive sites or the web page in question will be diluting their heading tags so much that it won&#8217;t actually achieve it&#8217;s objective anyway.</p>
<p>It&#8217;s much more beneficial to use heading tags for what they were meant for and to ensure that clear and concise text is used which uses the keyword and phrases that are being targetted within the search engines than over using the tags in places that they weren&#8217;t meant to be used.</p>
<h2>7. Marking up side boxes and navigation with headings</h2>
<p>Headings should only be used to markup content on a page but are often misused to place headings on side boxes and navigation. This leads to the same headings being used across multiple pagesin every instance where these components are used. Not only does this make the content less accessible for things like screen readers but will the website won&#8217;t be making the best use of heading elements for search engines and therefore rankings will be suffering as a result.</p>
<p>To fix this problem, simply use the heading tags for the main content on the page and use none semantic elements (&lt;span&gt; and &lt;div&gt;) for marking up content that doesn&#8217;t require semantic meaning.</p>
<h2>Summary</h2>
<p>Once you understand how headings should be used to give proper structure and semantic meaning to an HTML document it comes as second nature to use them correctly.</p>
<p>Do you follow these principles? Do you disagree with any of the above points? Please feel free to comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/7-common-mistakes-when-using-the-html-heading-element/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Cufón Font Replacement</title>
		<link>http://www.dave-woods.co.uk/index.php/cufon-font-replacement/</link>
		<comments>http://www.dave-woods.co.uk/index.php/cufon-font-replacement/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 17:41:19 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/index.php/cufon-font-replacement/</guid>
		<description><![CDATA[Cufón is a font replacement method similar to the sIFR method. But where sIFR was sometimes slow in replacing the font, required flash and was tricky to setup, Cufón looks set to do away with all those problems. Cameron Moll has put together an excellent write up on Cufón font embedding over on his blog [...]]]></description>
			<content:encoded><![CDATA[<p>Cufón is a font replacement method similar to the <a href="http://wiki.novemberborn.net/sifr/">sIFR</a> method. But where sIFR was sometimes slow in replacing the font, required flash and was tricky to setup, Cufón looks set to do away with all those problems.</p>
<p><span id="more-244"></span></p>
<p>Cameron Moll has put together an excellent write up on <a href="http://cameronmoll.com/archives/2009/03/cufon_font_embedding/">Cufón font embedding</a> over on his blog so if you&#8217;re looking for an in depth review and how to set it up then it&#8217;s definitely worth having a read of his article.</p>
<p>I&#8217;ve had a quick play around with it and am very impressed with how easy it was to set up. When I first had a play around with sIFR it must have taken me a few hours to setup a font rendering how I was expecting it to. However, ten minutes of playing around with Cufón and I had something thrown together which actually worked.</p>
<p>There are a few bugs and issues with Cufón that Cameron&#8217;s article goes into but even with those taken into consideration, I&#8217;d still be tempted to use Cufón over sIFR purely for the fact that it&#8217;s so easy to use and implement.</p>
<p>For more information and to get started with Cufón visit <a href="http://wiki.github.com/sorccu/cufon/about">http://wiki.github.com/sorccu/cufon/about</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/cufon-font-replacement/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating FAQs Using a Definition List</title>
		<link>http://www.dave-woods.co.uk/index.php/creating-faqs-using-a-definition-list/</link>
		<comments>http://www.dave-woods.co.uk/index.php/creating-faqs-using-a-definition-list/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 12:09:39 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/?p=197</guid>
		<description><![CDATA[With a lot of web developers finally becoming conscious of using the correct semantic elements for marking up their HTML document, I&#8217;m often asked how frequently asked question (FAQ) pages should be marked up. Within this tutorial, I&#8217;ll explain how I deal with FAQ pages and provide you with a couple of options that I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>With a lot of web developers finally becoming conscious of using the correct semantic elements for marking up their HTML document, I&#8217;m often asked how frequently asked question (FAQ) pages should be marked up. Within this tutorial, I&#8217;ll explain how I deal with FAQ pages and provide you with a couple of options that I&#8217;ve used in the past.</p>
<p><span id="more-197"></span></p>
<p>When dealing with content like tables and paragraphs, it&#8217;s usually quite easy to decide which element to use for the given circumstance. However, dealing with FAQs is slightly different in that there is no &lt;faq&gt; tag or a &lt;question&gt; and &lt;answer&gt; tag, so a slightly different approach needs to be taken to ensure that the FAQ is given the same semantic treatment as the rest of the page.</p>
<p>I&#8217;ve used a couple of different methods over the years for marking up lists.</p>
<h3>Heading and Paragraph Method</h3>
<p>The first method I used was to use a heading for the question, a paragraph for the answer and then group all the items together by using a surrounding div.</p>
<p><code>&lt;div id="faq"&gt;<br />
&lt;h2&gt;Can I use tables for creating a webpage?&lt;/h2&gt;<br />
&lt;p&gt;No, you should use Semantic HTML for the structure and CSS for the presentation&lt;/p&gt;<br />
&lt;h2&gt;Which browser should I support&lt;/h2&gt;<br />
&lt;p&gt;As a minimum you should support the latest versions of Firefox, Opera and Safari whilst you should also support IE7 and IE6&lt;/p&gt;<br />
&lt;/div&gt;</code></p>
<p>This method does work quite well but whilst it provides some semantic meaning, it never quite felt right. The FAQs are in essence a list of items but using headings and paragraphs doesn&#8217;t quite convey this meaning.</p>
<h3>Definition Lists</h3>
<p>So recently, I&#8217;ve started using a definition list to markup frequently asked question lists as I feel it gives each item much more meaning and groups elements together much more effectively.</p>
<p><code>&lt;dl id="faq"&gt;<br />
&lt;dt&gt;Can I use tables for creating a webpage?&lt;/dt&gt;<br />
&lt;dd&gt;No, you should use Semantic HTML for the structure and CSS for the presentation&lt;/dd&gt;<br />
&lt;dt&gt;Which browser should I support&lt;/dt&gt;<br />
&lt;dd&gt;As a minimum you should support the latest versions of Firefox, Opera and Safari whilst you should also support IE7 and IE6&lt;/dd&gt;<br />
&lt;/dl&gt;</code></p>
<p>I feel much happier using a definition list for FAQs as it groups the items much better than using a non-semantic div element. Definition terms are then used for the question and the definition description is used for the answer which I feel groups each pair of items much better than any other method.</p>
<p>You could then quite easily use CSS to style this accordingly to give a clearer understanding visually to your definition list. For example:</p>
<p><code>* {<br />
margin: 0; padding: 0;<br />
}<br />
body {<br />
font: 100%/1.5 "lucida sans", verdana, arial, helvetica, sans-serif;<br />
padding: 10px;<br />
}<br />
h1 {<br />
font-size: 1.4em;<br />
}<br />
#faq {<br />
font-size: 0.8em;<br />
border: solid 1px #999;<br />
padding: 0.5em;<br />
}<br />
#faq dt {<br />
background-color: #CCC;<br />
padding: 0.3em;<br />
font-weight: bold;<br />
}<br />
#faq dd {<br />
padding: 0.5em 0.3em 1em;<br />
}</code></p>
<h3>Summary</h3>
<p>As FAQs are quite a subjective topic, there are bound to be numerous different ways of presenting this kind of information. I&#8217;ve seen them represented using tabular data and even just using paragraphs styled differently using CSS but personally I feel the two options above are much tidier and semantically better solutions with the definition list being my preferred option.</p>
<p>What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/creating-faqs-using-a-definition-list/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>HTML Elements Quiz</title>
		<link>http://www.dave-woods.co.uk/index.php/html-elements-quiz/</link>
		<comments>http://www.dave-woods.co.uk/index.php/html-elements-quiz/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 16:20:28 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/?p=127</guid>
		<description><![CDATA[How many HTML elements can you name in five minutes? Whilst reading Peter Gasston&#8217;s Broken Links blog, I came across the following HTML quiz. Take the HTML Element Quiz There&#8217;s 91 elements altogether&#8230; how many can you name? It&#8217;s harder than it looks but have a go and please feel free to let me know [...]]]></description>
			<content:encoded><![CDATA[<p>How many HTML elements can you name in five minutes?</p>
<p><span id="more-127"></span></p>
<p>Whilst reading <a href="http://www.broken-links.com/2007/11/30/infuriating-html-quiz/">Peter Gasston&#8217;s Broken Links</a> blog, I came across the following HTML quiz.</p>
<ul>
<li><a href="http://www.justsayhi.com/bb/html_quiz">Take the HTML Element Quiz</a></li>
</ul>
<p>There&#8217;s 91 elements altogether&#8230; how many can you name?</p>
<p>It&#8217;s harder than it looks but have a go and please feel free to let me know how you did in the comments below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/html-elements-quiz/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Block and Inline elements: Part two</title>
		<link>http://www.dave-woods.co.uk/index.php/block-and-inline-elements-part-two/</link>
		<comments>http://www.dave-woods.co.uk/index.php/block-and-inline-elements-part-two/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 10:19:13 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/?p=95</guid>
		<description><![CDATA[In Block and Inline elements: Part one, I explained the difference between block and inline elements and how the default display for these elements is presented. Within this part, I&#8217;ll explain how you can use CSS to alter the display of these elements to help with the presentation. Block elements As I explained in the [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.dave-woods.co.uk/?p=94">Block and Inline elements: Part one</a>, I explained the difference between block and inline elements and how the default display for these elements is presented.</p>
<p>Within this part, I&#8217;ll explain how you can use CSS to alter the display of these elements to help with the presentation.<span id="more-95"></span></p>
<h3>Block elements</h3>
<p>As I explained in the previous part, block elements by default will fill 100% of the available width and will automatically force a new line.</p>
<p>However, in some circumstances it makes semantic sense to use a block element even though the appearance of this isn&#8217;t quite right and in these situations we can use CSS.</p>
<p>For example, menu items are a list of links and therefore we should use an unordered list to display them. For example:</p>
<p><code>&lt;ul&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;Services&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;Portfolio&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;</code></p>
<p>Which is great but what if we want to display these in a horizontal navigation bar?</p>
<p>We need to alter the default display so that each list item can be displayed inline.</p>
<p><code>* { padding: 0; margin: 0; }<br />
li { list-style-type: none; display: inline; }</code></p>
<p>This works great but what if you want to add a width or height to a list item?</p>
<p><code>* { padding: 0; margin: 0; }<br />
li { list-style-type: none; display: inline; <strong>width: 150px;</strong> }</code></p>
<p>A width or height will <strong>not</strong> displayed on an inline element so the width on the above code will have no impact. However, there is a solution to this little problem using float&#8217;s.</p>
<p><code>li { list-style-type: none; float: left; width: 150px; }</code></p>
<p>By floating each list item to the left, it will give the appearance of an inline element and will also by default only take up as much space as is required in the same way as an inline element but will also allow you to style them as if they were block elements. Therefore width and height can be applied to float&#8217;s successfully irrespective of whether the element has a default display of block or inline which is the reason why float&#8217;s are used so much in web design.</p>
<p>The same principle can be applied to all block level elements and is a useful technique to be aware of.</p>
<h3>Inline elements</h3>
<p>Inline elements are slightly different as it is much rarer that you&#8217;ll need to alter an inline elements display but there are certain circumstances when you may need to do this and it&#8217;s perfectly acceptable to do so.</p>
<p>Sometimes I&#8217;ll find that I&#8217;ve had to use an inline element but need it to fill the whole width and to break onto a new line so changing the element&#8217;s display into block is the perfect solution.</p>
<p>The best example of this and the most common in my experience is when dealing with &lt;a&gt; the  tag. When dealing with navigation, I may want style a link so that it appears more like a button but obviously a width cannot be applied directly to an inline element and therefore there&#8217;s no way of setting the width of the link to completely fill it&#8217;s container without changing it&#8217;s display.</p>
<p>Take the HTML code in the example above and apply a background colour to the link like so:</p>
<p><code>* { padding: 0; margin: 0; }<br />
li { list-style-type: none; float: left; width: 150px;}<br />
a { background-color: #CCC; }<br />
a:hover { background-color: #000; }</code></p>
<p>This works well but only applies the effect to the text. Even if you were to apply a width to the , it won&#8217;t have any effect due to it being an inline element.</p>
<p>However, if we change the display value of the  to display block, it will open up a whole new set of options.</p>
<p><code>* { padding: 0; margin: 0; }<br />
li { list-style-type: none; float: left; width: 150px;}<br />
a {	background-color: #CCC; <strong>display: block;</strong> }<br />
a:hover { background-color: #000; }</code></p>
<p>This will now force the  element to completely fill it&#8217;s parent&#8217;s container which we&#8217;ve already specified as being 150px and will also allow much more flexibility when styling this element.</p>
<p>For example, you could now apply the following CSS to the HTML we first started out with and create all kinds of navigational menu&#8217;s that wouldn&#8217;t be achievable without changing the display value.</p>
<p><code>* { padding: 0; margin: 0; }<br />
body { font-family: verdana, arial, helvetica, sans-serif; font-size: 75%; }<br />
li { list-style-type: none; float: left; width: 150px; margin-right: 2px;}<br />
a {	background-color: #CCC; display: block; padding: 2px; text-align: center; color: #000; }<br />
a:hover { background-color: #000; color: #FFF; }</code></p>
<p>There&#8217;s many possibilities and effects you can achieve by simply changing the display of an element and we&#8217;ve only really covered two of the most common uses here but the same principle applies to all elements so understanding the basics of the block and inline elements is essential in getting the most from your code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/block-and-inline-elements-part-two/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Block and Inline elements: Part one</title>
		<link>http://www.dave-woods.co.uk/index.php/block-and-inline-elements-part-one/</link>
		<comments>http://www.dave-woods.co.uk/index.php/block-and-inline-elements-part-one/#comments</comments>
		<pubDate>Thu, 20 Sep 2007 09:28:13 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/?p=94</guid>
		<description><![CDATA[CSS is an important part of any web designer&#8217;s skills and therefore it&#8217;s extremely important that a designer understands how block elements and inline elements work together and how they can be styled using CSS. This article will explain the default display values of the most commonly used HTML elements whilst part two of this [...]]]></description>
			<content:encoded><![CDATA[<p>CSS is an important part of any web designer&#8217;s skills and therefore it&#8217;s extremely important that a designer understands how block elements and inline elements work together and how they can be styled using CSS. This article will explain the default display values of the most commonly used HTML elements whilst part two of this article will explain how CSS can be used to alter the display and visual appearance of these elements.</p>
<p><span id="more-94"></span></p>
<h3>Block elements</h3>
<p>Block elements take up the full width of the page and are naturally displayed on a new line. Block elements can not be nested within inline elements.</p>
<h4>Examples of block elements</h4>
<ul>
<li>&lt;div&gt;</li>
<li>&lt;h1&gt; &#8230; &lt;h6&gt;</li>
<li>&lt;p&gt;</li>
<li>&lt;table&gt;</li>
<li>&lt;ul&gt;, &lt;ol&gt;, &lt;dl&gt;</li>
<li>&lt;li&gt;, &lt;dt&gt;, &lt;dd&gt;</li>
<li>&lt;form&gt;</li>
<li>&lt;blockquote&gt;</li>
<li>&lt;pre&gt;</li>
<li>&lt;address&gt;</li>
<li>&lt;fieldset&gt;</li>
</ul>
<h3>Inline elements</h3>
<p>Inline elements only take up as much width as is required to display the element and will not force a new line.</p>
<h4>Examples of inline elements</h4>
<ul>
<li>&lt;span&gt;</li>
<li>&lt;img&gt;</li>
<li>&lt;a&gt;</li>
<li>&lt;strong&gt;</li>
<li>&lt;em&gt;</li>
<li>&lt;br&gt;</li>
<li>&lt;input&gt;, &lt;textarea&gt;</li>
<li>&lt;abbr&gt;</li>
<li>&lt;acronym&gt;</li>
</ul>
<h3>Not displayed</h3>
<p>Some HTML tags are not displayed and should usually be placed within the head of the document.</p>
<h4>Examples of none displaying elements</h4>
<ul>
<li>&lt;meta&gt;</li>
<li>&lt;style&gt;</li>
<li>&lt;script&gt;</li>
</ul>
<p><a href="http://www.dave-woods.co.uk/?p=95">Block and Inline elements: Part two</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/block-and-inline-elements-part-one/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Debugging HTML and CSS</title>
		<link>http://www.dave-woods.co.uk/index.php/debugging-html-and-css/</link>
		<comments>http://www.dave-woods.co.uk/index.php/debugging-html-and-css/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 11:08:04 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/?p=65</guid>
		<description><![CDATA[HTML and CSS is an art. Give the same design to different developers and the code they deliver will never be identical. This can cause a number of problems when developing a website and ultimately in tracking down problems. This article has been created, not to solve all HTML and CSS issues but to ultimately [...]]]></description>
			<content:encoded><![CDATA[<p>HTML and CSS is an art. Give the same design to different developers and the code they deliver will never be identical. This can cause a number of problems when developing a website and ultimately in tracking down problems. This article has been created, not to solve all HTML and CSS issues but to ultimately help designers and developers to track down those annoying little layout problems and to at least demonstrate how to isolate issues with their code.<span id="more-65"></span></p>
<h3>Validate HTML</h3>
<p>I&#8217;ve said it hundreds of times, if the HTML code that&#8217;s being read by the browser isn&#8217;t valid then it&#8217;s highly unlikely that what you&#8217;ll see will be consistent across all the standards compliant browsers.</p>
<p>More experienced web developers will generally design a site and then test at the end to ensure that there&#8217;s no tiny little glitches that have been missed. However, for beginners it is imperative that they test their site as they&#8217;re developing. <a href="http://validator.w3.org/">The W3C Markup Validator</a> is a vital tool for any developer and should be used during development to ensure that there aren&#8217;t hundreds of issues to fix once a site has been built. Fixing problems as they appear is much easier than trying to rework all your HTML code at the end of a project.</p>
<h3>Validate CSS</h3>
<p>Once you&#8217;ve ensured that your HTML is valid, it&#8217;s time to check that the CSS you&#8217;ve created is also valid with no spelling errors. It&#8217;s easily done and missing out a } or ; can have huge implications on your layout. You can check your CSS at <a href="http://jigsaw.w3.org/css-validator/">http://jigsaw.w3.org/css-validator/</a> and is something I&#8217;d definitely recommend doing.</p>
<h3>Needle in a Hay Stack</h3>
<p>So you&#8217;ve validated the site but it&#8217;s still not quite appearing how you&#8217;d expect it to in one or more browsers. This is usually the situation that people find themselves in at the end of a project when they&#8217;ve built a site and are browser testing. They have lots of HTML and CSS and something is slightly out of place but there&#8217;s so much code that it&#8217;s almost impossible to know what to change. The ideal situation would be to have tested in each browser during development but starting again is pretty much out of the question at this stage. So how can I isolate that single bit of code amongst hundreds of lines of HTML?</p>
<h3>Firefox Web Developer Tool bar</h3>
<p>Firstly, for people using Firefox, the <a href="http://chrispederick.com/work/web-developer/">Web Developer Tool bar Extension</a> is a priceless plug-in that can save a great amount of time. Outlining block level elements is probably the feature I use the most as you can instantly see where the borders of elements are and the spacing of these elements including the padding and margins although using the display topographic information can be just as useful.</p>
<h3>Outlining Body Elements</h3>
<p>But my problem is in Internet Explorer, I hear you cry. I&#8217;m sure there are other tool bars available for all browsers by now but I prefer a simpler approach when debugging.</p>
<p>Using CSS I apply the following:</p>
<p><code><br />
div {<br />
border: solid 1px red;<br />
}<br />
</code></p>
<p>This will outline all divs within the page on all browsers so I can easily see where the edges of divs meet. This is extremely useful if you&#8217;re unsure whether paddings and margins are being applied or unsure what is forcing a div out of position. Exactly the same principle can be applied to other elements as well. However, you should be careful as this does add an extra couple of pixels to either side of the element it&#8217;s applied to so may knock your design out slightly, as long as you&#8217;re aware of this though then it can be useful in spotting the problem.</p>
<h3>Isolating a Problem</h3>
<p>If using the outlining body elements method didn&#8217;t manage to get you any closer to solving the problem don&#8217;t worry, there&#8217;s still an easier way to find out what the problem is without going through each individual part of the page and tweaking the HTML only to find that you still haven&#8217;t found the problem.</p>
<p>Well coded websites are usually divided up into separate sections. Whether this is by using div&#8217;s or by using id&#8217;s within body elements is irrelevant but most pages I deal with will have clear areas of code that are clearly defined.</p>
<p>Please note: At this stage, I&#8217;d recommend making a copy of your page as you&#8217;ll be removing lines of code from your page. Speaking from experience it only takes an accidental close of your HTML editor or a power cut to lose hours or days worth of work.</p>
<p>Once you&#8217;ve made a copy, start by removing large areas of your page. Start with areas that you&#8217;re pretty sure aren&#8217;t responsible for the problem. If the problem seems to be within your footer, try removing the header and then refresh the page. If the problem is still there, remove the navigation and so on until you&#8217;re left with just a few lines of code. Quite often I&#8217;ve found that a problem has been caused by an area of the page that I&#8217;d never have expected it to be and only by following this process of eliminating code have I tracked down where the issue is.</p>
<p>Now that you know that the problem is being caused by this area of the page it&#8217;s time to delve into the CSS and see what part of the CSS is causing the issue.</p>
<p>It may be useful to apply background colours to the individual styles you have left in your page. This can sometimes highlight a problem quite obviously with the padding and margins which may have been overlooked during an earlier stage. It may also show that there&#8217;s a problem with a mixture of block and inline elements which is quite common so this step makes those issues easier to spot.</p>
<p>I&#8217;d then suggest removing a complete CSS style and seeing what happens. If the problem is still there then try another CSS style. It shouldn&#8217;t take too long before you find which CSS style is causing the problem. Once I&#8217;ve highlighted the style that&#8217;s causing the problem, I&#8217;ll start removing one value at a time from this style. For example, remove padding and margins from this style, refresh the page and see if that solves the problem?</p>
<p>Eventually you&#8217;ll have tracked any problems down to one or two styles that may be conflicting with each other or that a certain browser doesn&#8217;t render quite as expected (I&#8217;m looking at IE when I say that) and a fix can be put in place.</p>
<h3>Summary</h3>
<p>Learning fixes for HTML and CSS problems will come with experience and initially you may need to ask for advise, but having the knowledge to be able to track down where a problem lies in the first place is certainly a skill that is easy to come by if you understand the process.</p>
<p>Do you debug HTML and CSS differently? Do you have a more efficient method? Please feel free to leave any comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/debugging-html-and-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quick tip: Doctype</title>
		<link>http://www.dave-woods.co.uk/index.php/quick-tip-doctypes/</link>
		<comments>http://www.dave-woods.co.uk/index.php/quick-tip-doctypes/#comments</comments>
		<pubDate>Fri, 06 Jul 2007 10:26:38 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/?p=57</guid>
		<description><![CDATA[A DOCTYPE (short for &#8220;document type declaration&#8221;) informs the validator which version of (X)HTML you&#8217;re using, and must appear at the very top of every web page. In this quick tip I&#8217;ll be going through the valid doctypes that you should use at the start of your document. HTML 4.01 Strict &#60;!DOCTYPE HTML PUBLIC "-//W3C//DTD [...]]]></description>
			<content:encoded><![CDATA[<p>A DOCTYPE (short for &#8220;document type declaration&#8221;) informs the validator which version of (X)HTML you&#8217;re using, and must appear at the very top of every web page. In this quick tip I&#8217;ll be going through the valid doctypes that you should use at the start of your document.<br />
<span id="more-57"></span></p>
<h3>HTML 4.01 Strict</h3>
<p><code> &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;<br />
</code></p>
<h3>HTML 4.01 Transitional</h3>
<p><code> &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;<br />
</code></p>
<h3>HTML 4.01 Frameset</h3>
<p><code> &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"&gt;<br />
</code></p>
<h3>XHTML 1.0 Strict</h3>
<p><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;<br />
</code></p>
<h3>XHTML 1.0 Transitional</h3>
<p><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;<br />
</code></p>
<h3>XHTML 1.0 Frameset</h3>
<p><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"&gt;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/quick-tip-doctypes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Differences between HTML5 and HTML4</title>
		<link>http://www.dave-woods.co.uk/index.php/html-5-differences-from-html-4/</link>
		<comments>http://www.dave-woods.co.uk/index.php/html-5-differences-from-html-4/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 19:59:29 +0000</pubDate>
		<dc:creator>Dave Woods</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.dave-woods.co.uk/?p=50</guid>
		<description><![CDATA[From the W3C HTML Working Group, an excellent summary of the significant differences between HTML 4 and the current draft of HTML 5. None of this is final, and the document itself is under active development, but it’s a very worthwhile read nonetheless. http://dev.w3.org/cvsweb/~checkout~/html5/html4-differences/Overview.html]]></description>
			<content:encoded><![CDATA[<p>From the W3C HTML Working Group, an excellent summary of the significant differences between HTML 4 and the current draft of HTML 5. None of this is final, and the document itself is under active development, but it’s a very worthwhile read nonetheless.</p>
<p><a href="http://dev.w3.org/cvsweb/%7Echeckout%7E/html5/html4-differences/Overview.html" title="HTML differences - External Link"> http://dev.w3.org/cvsweb/~checkout~/html5/html4-differences/Overview.html </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dave-woods.co.uk/index.php/html-5-differences-from-html-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

