I mentioned in my last tech blog post that HTML had taken a back step from telling browsers how to display content, and that this job had been taken over by CSS (Cascading Style Sheets). But wait! Not so fast! What does HTML do now, and what's good and bad about it?
First then, what does it do?
In the new way of things, HTML allows you to specify and mark up content, leaving CSS to define how the content is displayed. So for example if I have a menu and some body text, those parts of the page might look like this in HTML:
<div class="menuitem"><a href="/">home</a></div>
<div class="menuitem"><a href="/about">about us</a></div>
We are a fabulous company selling t-shirts of all sizes
Note that nowhere does it say where the menu should go or what it should look like - the HTML just provides content and defines the purpose of the content - e.g. "menuitem", for the CSS to get to work on.
HTML is good because it provides a simple, text-editable way of getting content online, readable, and linking with other content.
The bad part is that there are so many legitimate ways of expressing the same thing, and despite attempts to tidy up everyone's usage, because of the number of websites out there that use antiquated methods of displaying information, it's difficult to break away from the old.
So for example, <i> means italic, but so does <em>, and so does <span style="font-style:italic">. Or if I want to organise something into a list, I could use a list tag, a table, or just div tags one on top of the other.
To write good HTML I'd recommend packing Dreamweaver back into its box and buying a book specifically aimed at HTML 5 and CSS (at time of writing HTML 5 is the most up-to-date version). This will help you on your way to write standards-driven (and therefore future-proof) web pages.