Archive for ‘simplequiz’ category

SimpleQuiz › Part VIII › Titles

With this question (based on a suggestion by Shaun Inman), I’m hoping the discussion touches on a few different things that happen to be going on.

I’ll leave it at that for now, and let you all weigh in.

Q: When marking up a book title or publication, which of the following is the best choice?

  1. <p>My upcoming book, <em>SimpleQuiz: Get Down With Markup</em>, will be a bestseller.</p>
  2. <p>My upcoming book, <i>SimpleQuiz: Get Down With Markup</i>, will be a bestseller.</p>
  3. <p>My upcoming book, <cite>SimpleQuiz: Get Down With Markup</cite>, will be a bestseller.</p>

SimpleQuiz › Order Up › Conclusion

Looking over the comments from the question, it appears that most saw either A or B as semantically equal. Adam Polselli brought up an interesting point though on a possible benefit to choosing option A:

I think that there’s an advantage to using A. If you style your links as “font-weight: normal“, then having the <a> tag inside the <strong> tag would override <strong>‘s “bolding.”

Certainly that is something to think about, even when either order would work for you.

Good arguments were presented for either method, with some pointing to whether the link itself needed strong emphasis or just the text contained.

I’ll admit, I’m feeling a little lazy with writing this wrap-up — not because the discussion for this one was any less illuminating, but because there were many, for lack of a better term, thought provoking comments making a case for either order. Just read through these. Class dismissed.

Read all quiz questions and conclusions.

SimpleQuiz › Part VII › Order Up

This quiz focuses on element ordering, and is based on a suggestion from Paul Smith. When hyperlinks are coupled with inline phrase elements (such as strong, em, abbr, etc.) are there any consequences in regards to the ordering?

Q: Which of the following is more semantically correct, and are there advantages to either method?

  1. <a href=""><strong>The Greatest Web Site Ever</strong></a>
  2. <strong><a href="">The Greatest Web Site Ever</a></strong>

SimpleQuiz › Form(atting) › Conclusion

This was a tough one to wrap up. There are probably more acceptable possibilities with this question than with previous questions. A lot of great examples were brought to light regarding label and fieldset elements.

Notable Comments

Simon Willison:

…once I start working with forms I switch my focus from semantics to accessibility and usability.

Excellent point. It’s always good practice to ask yourself whether you’re being semantic for the sake of being semantic. Have I mentioned that I don’t like the actual word “semantic”? I don’t.


I don’t really consider a form label and text field a paragraph so that’s out.

This was echoed through the rest of the discussion as well. However, it just might give you better results in the nonstyled version (as opposed to using a
div or label or nothing).

And while using nothing might not appeal to you, MikeyC pointed out that it will not validate without a block-level element surrounding the label.

Which brings us to using fieldset, which Dave S. first suggested. The use of fieldset opened the floodgates on a host of great examples, and for simple small forms, fieldset and some CSS applied might be all you really need.

The use of fieldset was also argued a bit, back and forth. On one hand, you could see this as purely a presentational addition, and on the other hand you could quote the W3C:

The FIELDSET element allows authors to group thematically related controls and labels. Grouping controls makes it easier for users to understand their purpose while simultaneously facilitating tabbing navigation for visual user agents and speech navigation for speech-oriented user agents. The proper use of this element makes documents more accessible.

I like the sound of that.

You can’t talk about forms without talking about using table to format them. Paul G.:

… it ensures that labels and inputs maintain a logical visual order and layout when CSS is off

Certainly for larger forms, when you’re dealing with multiple controls, inputs, form fields, drop-downs, etc. — tables still seem like the best way to go. You could argue either way, whether a form is tabular data — but the truth is, styling a large form soley with CSS is not a simple task, and undoubtedly will not degrade nicely.

Summary (my take)

When it comes to marking up forms, I’ll take the following into account:

  • When marking up a small form with a few elements, I’ll use fieldset and CSS to style them — taking into account what the unstyled form will look like.
  • Tables still are not evil. For large forms, in order to make the form useable and organized, it’s hard to beat the simplicity of a table here. CSS techniques seem to be somewhat complicated in a place where a simple table would work all around.
  • In the past, I’ve used p tags to group label and matching input tags. I’m now divided on this method. For simple forms, it will ensure consistent formatting across browsers yet could be argued that it is not a paragraph of text.
  • Trying to semantically structure a form makes my head hurt.

See all quiz questions and discussions in chronological order.

SimpleQuiz › Part VI › Form(atting)

Let’s talk forms. A lot my web design headaches are caused while formatting form items. This quiz question comes to us from MikeyC:

Q: When marking up forms, which is more semantically correct when separating form items?

  1. <form>
    <p><label for="name">Name:</label>
    <input type="text" id="name" /></p>
  2. <form>
    <label for="name">Name:</label>
    <input type="text" id="name" />
  3. <form>
    <label for="name">Name:</label>
    <input type="text" id="name" /><br /><br />

See all previous quiz questions and wrap-ups.

SimpleQuiz › Site and Page Titles › Conclusion

This question was probably the most vague — and there certainly wasn’t a clear-cut right or wrong answer. But that’s why I like it. I enjoy hearing what others think about the relationship of the title and h1 tags.

Notable Comments

Many agreed that ceejayoz’s example was the best-case scenario, which was most like answer A:

  <title>Widget Co, Inc. | List of Widgets</title>

<div id="logo">
  Widget Co, Inc.
<h1>List of Widgets</h1>

I think I’m with ceejayoz here, and it’s certainly closest to what I’ve used in the past.

Egor Kloos:

H1 is a heading and isn’t a logo. A logo isn’t a Title and also isn’t a Heading. … A logo or even just a company name is not just a line of text, it is part of a companies assets. Treating it like it is a Title or heading and putting it in a H1 tag is a mistake…

Good points on a logo not being a heading.

Matthew Haughey:

Why put the same exact thing in an H1 on every page, making search engines think it’s the most important thing on the page, when it’s mostly just eye candy?

Search engines weigh h1 heavier than h2. Putting only the company name in there might be a waste.

Michael Z.:

But in terms of your page’s hierarchy, the <title> is like an <h0> that’s applied to the <html> element. Why repeat its content in your <h1>?

I like the h0 metaphor.

Dan R.:

How I would do it today:

<title>Page Title | Company Name or</title>
<div id="logo">
<p>Company Name, replaced by Logo graphic using FIR (or related technique)</p>
<h1>Page Title</h1>

A nice, complete example — and I agree with it all.

Summary (my take)

Here’s what I think, after hearing from you highly esteemed readers:

  • The title tag should contain the page and site title.
  • The logo doesn’t need to be a heading, and may live nicely in a div where it could be replaced with a background graphic using CSS.
  • h1 should be the title that most completely describes the document as a whole. This may or may not include the site title (again).

In the past, I have sort of tried to adhere to that. But going forward, this seems to make sense in an ideal world.

SimpleQuiz › Part V: Site and Page Titles

Our first reader-submitted quiz question from Thomas Lackner:

Q: Which is more semantically correct for a corporate web site (that does not require an image-based logo)?

  1. <div id="logo">
    Widget Co, Inc.
    <h1>List of Widgets</h1>
  2. <h1>Widget Co, Inc.</h1>
    <h2>List of Widgets</h2>

  3. <head>
    <title>Widget Co, Inc.</title>
    <h1>List of Widgets</h1>

This was touched upon in the comments of the first question, but I think it would be
interesting to get people’s opinion of what a best case scenario would be for the beginning structure of a document. Obviously, logo graphics play a part in
most corporate sites — but we’re strictly talking page structure here. Thanks to Thomas for sending this in.

SimpleQuiz › When to P › Conclusion

This past question has brought up some rather interesting points. Many readers chimed in on the fact that option B was better (wrapping the content in a p tag) due to nice formatting for un-styled viewers. Others saw it unnecessary, and more saw it fit to strip away that redundant div and style a p directly.

Notable Comments


I consider div to be the “duct tape” of CSS – no semantic meaning, purely a wrapper for the grouping of block-level elements or for styling itself.

Michael Z.:

… if there’s a chance in a million that your boss will decide next month that there must be second paragraph of fluff in the footer, then go with B.

Now that’s forward thinking.


What about <address>?

I hadn’t thought of it, but it’s a nice reminder.


… the responses in this thread are a good illustration of why “lorum ipsum” text should be used in such instances.

Heck yeah, and Ed Sharrer offers us the The Lorem Ipsum Generator.

Billy was the first to get at a major point I was attempting to make with this question:

Put the line of text in a p, set it’s id to “footer”, and get rid of the div.

Ah ha. Exactly. If this is just one line of text, why not add the id directly to the p tag itself? p is a block-level element as well, and div is just a generic one. A good way to trim down that code: Look at what lies directly beneath your div tags. If it’s another block-level element, look into styling that next level — directly.

For instance, if you have a form that is wrapped in a div, it may be possible to get rid of the div and let the form be the block-level element.

Oh, and extra credit goes to Doug Bowman:

I’d say the Charles DeMar he’s referencing has to do with these three words: Better Off Dead.

Right on the money.


One line of text within a div could be marked up with a paragraph, without one, or tossed out in place of styling the p directly.

Some considerations:

  • Think about the future. Will this one paragraph likely turn into two or three? Maybe it’s best to use a div.
  • If it’s always going to be one, why not bag the div and add the id to the p tag itself?
  • Look into using address for … well, addresses.
  • If you choose not to wrap a single line in paragraph tags, will this be ok for un-styled viewers?

See all past quiz questions and wrap-ups in chronological order.

SimpleQuiz › Part IV: When to P

Looking back, we’ve covered a lot of ground with just three questions, haven’t we? I realize I could go on for a dozen more questions about lists — different combinations, ordered lists, etc. I could also ask questions that are either too obvious for most, or delve too far into details for others.

So instead, here’s another topic that could just be splitting hairs again. The set-up: You have a block of text that you’re wrapping in a div (or any block-level element) and it contains just one paragraph or string of text. Note: the text used in the example is arbitrary.

Q: Are each of the following acceptable, and why (or why not)?

  1. <div id="footer">
       Copyright 2003 Charles DeMar | This text is arbitratry.
  2. <div id="footer">
       <p>Copyright 2003 Charles DeMar | This text is arbitratry.</p>

Extra Credit: Who is Charles DeMar?

SimpleQuiz › Heading and List › Conclusion

This question was intended to divide the results more so than the first two. While there isn’t much context included with the examples, I think what I got out of the discussion that followed is that either method is good depending on the situation.

Notable Comments

Robbert Broersma:

“I choose A, ’cause a definition-list consists of a term and a description. “Robots” is not a description of the term “A List of Stuff”.”

While this is true, others defend the use of a definition list for other applications, later in the discussion.

Dave Shea asks:

“…what constitutes a term/definition pairing? Is the term a word, can it be a phrase, can it be an image?”

A good question, and again I think is cleared up somewhat later on.

Anne van Kesteren:

“How about nested lists?”

Nested lists can certainly be useful as well, as an alternative.

Doug Bowman pretty much writes the wrap-up for me here:

“… My answer: ‘C’: depends.”

And after quoting an important sentence from the W3 specification for dl:

Another application of DL, for example, is for marking up dialogues, with each DT naming a speaker, and each DD containing his or her words.

“Clearly, there are uses for definition lists far beyond the traditional term and description.”

Doug goes on to give some good examples of definition lists with multiple descriptions — creating relationships between terms and multiple descriptions. A nice example of using a defintion list for more than just term/description pairs.


Defining lists with section dividers (I’ll refrain from using the the term “headings” here) has unlimited possibilities. Using the right combination depends heavily on the context. Some things to keep in mind:

  • Definition lists can not only be used for strict term/description pairings, but also for grouping separate lists together that are related.
  • Since search engines treat heading tags with greater importance, that should factor in your decision on whether or not to use them. (The W3 spec prohibits block-level elements within a dt.)

See all quiz questions and wrap-ups in chronological order.