Paragraph Elements are not for Spacing

Thursday, April 17, 2008

A friend of mine just launched a new business venture called StackOverflow . Jeff will be doing what he does best, and hopefully that will mean that we can contract him out to help us from time to time.

The reason I’m blogging about it here is his web site was clearly just thrown together to get it up on the web. For someone who spends his day finding new ways of dampening the sound on his Rock Band drum kit , I would think he’d be a little bit more 21st century (or even Web 2.0) about his web site.

Granted the web site is just an image and some text, the interesting thing here is the code. View source on his web site and you will find an example of an HTML technique that I thought was left back in 1996. That is he is using an unclosed paragraph element for spacing the text blocks on his page. Paragraph elements are for paragraphs.

The P element represents a logical paragraph”

Although in HTML it does not need to be closed, it seems to have been the best practice since about the time people were really hot on migrating to XHTML.

Because my wife is standing here telling me I can’t just insult Jeff’s new web site, I’ve decided to correct the HTML. Jeff, if you read any of my blogs, this is for you:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>stackoverflow</title>
    <meta name="description" content="Stackoverflow is sort of like the anti-experts-exchange (minus the nausea-inducing sleaze and quasi-legal search engine gaming) meets wikipedia meets programming reddit." /> 
  </head>
  <body>
    <div style="text-align:center; margin-top:100px;">
      <img src="http://img510.imageshack.us/img510/7056/thenamiracleoccursbx8.png" width="435" height="496" alt="I think you should be more explicit here in step two." title="I think you should be more explicit here in step two." />
    </div>
    
    <h2>Wondering what stackoverflow.com will be?</h2>
    <p>Listen to <a href="http://www.stackoverflow.com/audio/stackoverflow-podcast-001.mp3">the first stackoverflow podcast</a> with <a href="http://www.joelonsoftware.com/">Joel Spolsky</a> and <a href="http://www.codinghorror.com/blog/">Jeff Atwood</a>. (MP3 file, 8.32 MB, 46:12).</p>
      
    <p>If you'd like to submit a question to be answered in our next episode, record an audio file and mail it to <a href="mailto:podcast@stackoverflow.com">podcast@stackoverflow.com</a>. Remember, it <em>must</em> be an audio question -- 90 seconds or less, please.</p> 
  </body> 
</html>
HTMLhtml

This work is licensed under CC BY-NC-SA 4.0

Difference in Margin Between HTML and XAML

Silverlight SEO