HTML5 Doctor » Simplequiz http://html5doctor.com helping you implement HTML5 today Wed, 02 Mar 2016 08:08:54 +0000 en-US hourly 1 Simplequiz #7: Pinterest https://stevefaulkner.github.io/html5doctored/html5-simplequiz-7-pinterest/ https://stevefaulkner.github.io/html5doctored/html5-simplequiz-7-pinterest/#comments Tue, 22 Jan 2013 15:22:02 +0000 http://html5doctor.com/?p=4776 One of our readers commented on an article a while ago (I won't tell you which one just now ;) asking about marking up items on Pinterest. It struck me that this would be a prime candidate for a Simplequiz, so here we are.

]]>
One of our readers commented on an article a while ago (I won’t tell you which one just now ;) asking about marking up items on Pinterest. It struck me that this would be a prime candidate for a Simplequiz, so here we are.

Pinterest, for the uninitiated of you, allows you to organise and share things you love — mostly food, drink, and kittens.

Pinterest Homepage Screengrab
A distinct lack of kittens on Pinterest’s homepage in this screengrab

We’re going to look at how to mark up a single pinned item, as shown below:

Individual pinned item on PinterestIndividual pinned item on Pinterest
The item we’ll be marking up (bottom image is the hovered state)

The existing markup is below (I’ve simplified it a little to make it easier to read):

<div class="pin">
  <div class="pin-holder">
    <div class="actions">
      <a href="#repin">Repin</a>
      <a href="#like">Like</a>
      <a href="#comment">Comment</a>
    </div>
    <a href="me/cat/">
      <img src="cat.jpg" alt="My awesome cat">
    </a>
  </div>
  <p>Awesome cat description.</p>
  <p class="stats">
    <span>25 likes</span>
    <span>2 comments</span>
    <span>100 repins</span>
  </p>
  <div class="convo">
    <a href="/me/">
      <img src="me.jpg" alt="Profile picture of me">
    </a>
    <p><a href="/me/">Me</a> onto <a href="/here/">here</a></p>
  </div>
</div>

So, all’s well and good, but how should it be marked up in HTML5? As the saying goes, there are a hundred ways to skin a cat (excuse the pun). We’ve created five possible options, one of which achieved some consensus amongst the Doctors. Be warned: some of the differences between options are small and may be difficult to spot. Look carefully at each option!

Let us know which answer you would go with (or roll your own) in the comments. Make sure you show your working out. Also, please escape your HTML (or use pseudo code), or we’ll put a severed unicorn head skinned cat in your bed.

Answer A:

An <article>, with <nav> and <aside> elements:

<article class="pin">
  <div class="pin-holder">
    <nav class="actions">
      <a href="#repin">Repin</a>
      <a href="#like">Like</a>
      <a href="#comment">Comment</a>
    </nav>
    <a href="me/cat/">
      <img src="cat.jpg" alt="My awesome cat">
    </a>
  </div>
  <p>Awesome cat description.</p>
  <aside class="stats">
    <span>25 likes</span>
    <span>2 comments</span>
    <span>100 repins</span>
  </aside>
  <article class="convo">
    <a href="/me/">
      <img src="me.jpg" alt="Profile picture of me">
    </a>
    <p><a href="/me/">Me</a> onto <a href="/here/">here</a></p>
  </article>
</article>

Answer B:

An <article>, with <aside> elements:

<article class="pin">
  <div class="pin-holder">
    <aside class="actions">
      <a href="#repin">Repin</a>
      <a href="#like">Like</a>
      <a href="#comment">Comment</a>
    </aside>
    <a href="me/cat/">
      <img src="cat.jpg" alt="My awesome cat">
    </a>
  </div>
  <p>Awesome cat description.</p>
  <aside class="stats">
    <span>25 likes</span>
    <span>2 comments</span>
    <span>100 repins</span>
  </aside>
  <article class="convo">
    <a href="/me/">
      <img src="me.jpg" alt="Profile picture of me">
    </a>
    <p><a href="/me/">Me</a> onto <a href="/here/">here</a></p>
  </article>
</article>

Answer C:

An <article>, with <nav>, <figure>, and <aside> elements:

<article class="pin">
  <div class="pin-holder">
    <nav class="actions">
      <a href="#repin">Repin</a>
      <a href="#like">Like</a>
      <a href="#comment">Comment</a>
    </nav>
    <figure>
      <a href="me/cat/">
        <img src="cat.jpg" alt="My awesome cat">
        <figcaption>Awesome cat description.</figcaption>
      </a>
    </figure>
  </div>
  <aside class="stats">
    <span>25 likes</span>
    <span>2 comments</span>
    <span>100 repins</span>
  </aside>
  <article class="convo">
    <a href="/me/">
      <img src="me.jpg" alt="Profile picture of me">
    </a>
    <p><a href="/me/">Me</a> onto <a href="/here/">here</a></p>
  </article>
</article>

Answer D:

A <section>, with <aside> and <figure> elements:

<section class="pin">
  <div class="pin-holder">
    <aside class="actions">
      <a href="#repin">Repin</a>
      <a href="#like">Like</a>
      <a href="#comment">Comment</a>
    </aside>
    <figure>
      <a href="me/cat/">
        <img src="cat.jpg" alt="My awesome cat">
        <figcaption>Awesome cat description.</figcaption>
      </a>
    </figure>
  </div>
  <p class="stats">
    <span>25 likes</span>
    <span>2 comments</span>
    <span>100 repins</span>
  </p>
  <div class="convo">
    <a href="/me/">
      <img src="me.jpg" alt="Profile picture of me">
    </a>
    <p><a href="/me/">Me</a> onto <a href="/here/">here</a></p>
  </div>
</section>

Answer E:

A <div>, with child <article> and <aside> elements:

<div class="pin">
  <article class="pin-holder">
    <aside class="actions">
      <a href="#repin">Repin</a>
      <a href="#like">Like</a>
      <a href="#comment">Comment</a>
    </aside>
    <a href="me/cat/">
      <img src="cat.jpg" alt="My awesome cat">
      <p>Awesome cat description.</p>
    </a>
  </article>
  <aside class="stats">
    <span>25 likes</span>
    <span>2 comments</span>
    <span>100 repins</span>
  </aside>
  <div class="convo">
    <a href="/me/">
      <img src="me.jpg" alt="Profile picture of me">
    </a>
    <p><a href="/me/">Me</a> onto <a href="/here/">here</a></p>
  </div>
</div>

Your answers below, please, with your rationale, by Tuesday, 29th January.

Simplequiz #7: Pinterest originally appeared on HTML5 Doctor on January 22, 2013.

]]>
https://stevefaulkner.github.io/html5doctored/html5-simplequiz-7-pinterest/feed/ 64
HTML5 Simplequiz 6: Zeldman’s fat footer https://stevefaulkner.github.io/html5doctored/html5-simplequiz-6-zeldmans-fat-footer/ https://stevefaulkner.github.io/html5doctored/html5-simplequiz-6-zeldmans-fat-footer/#comments Fri, 04 Mar 2011 14:30:20 +0000 http://html5doctor.com/?p=2883

Related Posts:

]]>
A few years ago, Dan Cederholm published a series of articles called Simplequiz in which he posed some options for marking up a specified piece of content and invited readers to choose the one they felt was the best way to mark that up. The value was in the comments in which people said why they made that choice and debated the options (which means it is THE LAW that you read the preceeding comments before adding your own). With Dan’s blessing, we’re running an occasional series of HTML5 Simplequizzes.

For the last couple of years, it’s been fashionable to have “fat footers” in websites. Take, for example, Jeffrey Zeldman’s footer:

The bottom of Zeldman's blog has a fat footer

We see an area with a svelte black background, containing a super-glammo set of six images, each of which has a caption and links to other sites that Zeldman has an interest in: conferences, books, articles, podcasts. Below those images is a copyright notice, some more conventional footer links (contact, subscribe, style switcher) and a blue stripe:

A closeup of Zeldman’s fat footer

Being HTML5 ninjas, we know that we’ll wrap each image and its attendant caption within <figure> and <figcaption> elements – but what will we wrap the whole group of external links in?

Choose from the answers below please. Make sure you show your working out. Escape your HTML, please, or we’ll put a severed unicorn head in your bed.

A:

Figures as direct children of the <footer> element:

<footer>
<figure>…</figure>
…
<p><small>Copyright © 1995–2011 L. Jeffrey Zeldman.</small></p>
</footer>

B:

The figures in an <aside> element nested in the <footer>:

<footer>
<aside>
<figure>…</figure>
…
</aside>
<p><small>Copyright © 1995–2011 L. Jeffrey Zeldman.</small></p>
</footer>

C:

The images in a <nav> element inside the <footer>:

<footer>
<nav>
<figure>…</figure>
…
</nav>
<p><small>Copyright © 1995–2011 L. Jeffrey Zeldman.</small></p>
</footer>

D:

Images in a <div> element immediately before the <footer>:

<div>
<figure>…</figure>
…
</div>
<footer>
<p><small>Copyright © 1995–2011 L. Jeffrey Zeldman.</small></p>
</footer>

E:

Images in an <aside> element immediately before the <footer>:

<aside>
<figure>…</figure>
…
</aside>
<footer>
<p><small>Copyright © 1995–2011 L. Jeffrey Zeldman.</small></p>
</footer>

Your answers below, please, with your rationale, by Friday 12th March.

HTML5 Simplequiz 6: Zeldman’s fat footer originally appeared on HTML5 Doctor on March 4, 2011.

]]>
https://stevefaulkner.github.io/html5doctored/html5-simplequiz-6-zeldmans-fat-footer/feed/ 87
HTML5 Simplequiz 5: URLs of commenters https://stevefaulkner.github.io/html5doctored/html5-simplequiz-5-urls-of-commenters/ https://stevefaulkner.github.io/html5doctored/html5-simplequiz-5-urls-of-commenters/#comments Fri, 17 Dec 2010 14:30:57 +0000 http://html5doctor.com/?p=2741 Here's nice and simple Simplquiz for Christmas. Imagine a new site, with a news item in an <article> element. Within that are several user-submitted comments, each of which is in its own <article> element, as the spec recommends. Most commenting systems ask the commenter for his/ her URL, which is published in the header of the comment, usually as a link with the commenter's name as the linked text.

]]>
Here’s nice and simple Simplquiz for Christmas. Imagine a new site, with a news item in an <article> element. Within that are several user-submitted comments, each of which is in its own <article> element, as the spec recommends. Most commenting systems ask the commenter for his/ her URL, which is published in the header at the beginning of the comment, usually as a link with the commenter’s name as the linked text.

How would you code the URL of a person leaving a comment (assuming they provided one)? Remember that there may be multiple comments on any one page. Also note that we’re not going to worry about what element wraps each comment this time. Choose from the five options below, and explain your rationale in the comments.

A:

<header>
Comment by <a href="http://www.myspace.com/timbo/">Tim 
Berners-Lee</a>
</header>
WTF! LOL! U SUCK! KTHXBAI!

B:

<header>
Comment by <cite><a href="http://www.myspace.com/timbo">Tim 
Berners-Lee</a></cite>
</header>
WTF! LOL! U SUCK! KTHXBAI!

C:

<header>
Comment by <a href="http://www.myspace.com/timbo"><cite>Tim 
Berners-Lee</cite></a>
</header>
WTF! LOL! U SUCK! KTHXBAI!

D:

<footer>
Comment by <address><a href="http://www.myspace.com/timbo">Tim 
Berners-Lee</a></address>
</footer>
WTF! LOL! U SUCK! KTHXBAI!

E:

<h1>
Comment by <a href="http://www.myspace.com/timbo"><address>Tim 
Berners-Lee</address></a>
</h1>
WTF! LOL! U SUCK! KTHXBAI!

Your answers below, please, and show your working out. We’ll close comments and give our opinions on Wednesday 22 December.

Rules: It is THE LAW that you read the preceding comments before adding your own. Note: please DON’T USE ANGLE BRACKETS in your comments. Escape them with &lt; and &gt; or just use [foo] – we’ll know what you mean.

HTML5 Simplequiz 5: URLs of commenters originally appeared on HTML5 Doctor on December 17, 2010.

]]>
https://stevefaulkner.github.io/html5doctored/html5-simplequiz-5-urls-of-commenters/feed/ 55
HTML5 Simplequiz #4: figures, captions and alt text https://stevefaulkner.github.io/html5doctored/html5-simplequiz-4-figures-captions-and-alt-text/ https://stevefaulkner.github.io/html5doctored/html5-simplequiz-4-figures-captions-and-alt-text/#comments Fri, 05 Nov 2010 14:15:49 +0000 http://html5doctor.com/?p=2694

Related Posts:

]]>
A few years ago, Dan Cederholm published a series of articles called Simplequiz. Dan posed some options for marking up a specified piece of content and invited readers to choose the one they felt was the best way to mark that up. The value was in the comments, where people defended their choices and debated the options (which means it is the law that you read the preceding comments before adding your own).

With Dan’s blessing, we’re running an occasional series of HTML5 Simplequizzes.

HTML5 offers a way to associate a figure (which can be an image, a video, a graph, a table, a pull-quote) with a caption using the <figure> element. This is very common in print, but there has been no way to do this in HTML4, as there is no element that groups a figure and a caption (other than a semantically-empty <div>).

Our question this week is about alternate text for images that are captioned. I’ve gotten this wrong before (in print, embarrassingly), as have two highly-clueful friends of mine. The man who set us right will be your moderator and quizmaster this week, Steve Faulkner of The Paciello Group, possibly the most respected accessibility agency out there.

We have an image as a figure in a story simply about a dignitary opening a new branch of Mr Lidl’s marvelous emporium. The caption will be “Mayor of Casterbridge opens a new Lidl supermarket”.

Generic picture of man cutting ribbon

What’s the best markup for this? Show your working out.

A:

 <figure>
 <img src=blah.png 
  alt="A portly gent cuts a ribbon. He is with five small children, and is watched by two middle-aged woman, a very tall smiling man, and a small crowd">
  <figcaption>
  Mayor of Casterbridge opens a new Lidl supermarket.
  </figcaption>
 </figure>

B:

<figure role=img aria-labelledby=lidl>
<img src=blah.png alt="">
 <figcaption id=lidl>
  Mayor of Casterbridge opens a new Lidl supermarket.
 </figcaption>
</figure>

C:

<figure>
<img src=blah.png>
 <figcaption>
 Mayor of Casterbridge opens a new Lidl supermarket.
 </figcaption>
</figure>

D:

<figure>
<img src=blah.png alt="">
 <figcaption>
 <p>Mayor of Casterbridge opens a new Lidl supermarket.</p>
 </figcaption>
</figure>

E:

<figure>
<img src=blah.png alt="Mayor of Casterbridge opens a new Lidl supermarket.">
 <figcaption>
  Mayor of Casterbridge opens a new Lidl supermarket.
</figcaption>
</figure>

Steve will wrap up the quiz next Thursday.

HTML5 Simplequiz #4: figures, captions and alt text originally appeared on HTML5 Doctor on November 5, 2010.

]]>
https://stevefaulkner.github.io/html5doctored/html5-simplequiz-4-figures-captions-and-alt-text/feed/ 63
HTML5 Simplequiz #3: how to mute a video https://stevefaulkner.github.io/html5doctored/html5-simplequiz-3-how-to-mute-a-video/ https://stevefaulkner.github.io/html5doctored/html5-simplequiz-3-how-to-mute-a-video/#comments Fri, 15 Oct 2010 08:35:16 +0000 http://html5doctor.com/?p=2628

Related Posts:

]]>
This is a bit of a special Simplequiz this week. Simon Pieters (@zcorpan), who works on multimedia QA for Opera and is one of those working on the HTML5 spec, asked us to run a quiz that would help the spec writers decide on a new aspect of the language. What power you wield, gentle reader! Over to Simon…

This SimpleQuiz is a bit different to previous SimpleQuizzes, since we’d like to use the result of this quiz to inform a design decision in the HTML5 spec. The question concerns how to mute a video in markup, and how this should be reflected in the DOM.

The use case is wanting to have multiple videos playing at once, but with all but one being muted at a time.

This can be done today by setting .muted = true with script, but it would be more convenient to be able to mute with markup.

The .muted IDL attribute reflects the user setting of muted for the video element — if the user clicks “mute” in the native video controls, then the value of .muted changes, and vice versa. It would make sense for the browser to remember the mute setting for individual video elements on page reload (or later visit), so that the user doesn’t have to re-mute them.

This is where it starts to get hairy if we introduce a content attribute for muting. (Note that code fragments below aren’t real code, just suggestions.)

We could introduce muted="" which is reflected by .muted (i.e. if one changes, so does the other), but this would cause the DOM to mutate during parsing if the remembered setting doesn’t match the markup, i.e. you would get muted="" to appear in the DOM if the video is muted by the user even though there was no such attribute in the markup, which could confuse your scripts or style sheets if it’s not what you expected to happen.

We could introduce defaultmuted="" which is reflected by .defaultMuted, and just let the user setting change .muted, but defaultmuted="" is a bit long and ugly in markup.

We could have muted="" which is reflected by .defaultMuted and let the user setting change .muted, but it might be confusing for some people. On the other hand it is consistent with <input value> and .defaultValue.

What do you think? Which is the best option? Is there another option that is better than any of the above?

HTML5 Simplequiz #3: how to mute a video originally appeared on HTML5 Doctor on October 15, 2010.

]]>
https://stevefaulkner.github.io/html5doctored/html5-simplequiz-3-how-to-mute-a-video/feed/ 32
HTML5 Simplequiz #2: citing people https://stevefaulkner.github.io/html5doctored/html5-simplequiz-2-citing-people/ https://stevefaulkner.github.io/html5doctored/html5-simplequiz-2-citing-people/#comments Fri, 08 Oct 2010 13:24:27 +0000 http://html5doctor.com/?p=2584 A few years ago, Dan Cederholm published a series of articles called Simplequiz in which he posed some options for marking up a specified piece of content and invited readers to choose the one they felt was the best way to mark that up. The value was in the comments in which people said why they made that choice and debated the options (which means it is THE LAW that you read the preceeding comments before adding your own).

]]>
A few years ago, Dan Cederholm published a series of articles called Simplequiz in which he posed some options for marking up a specified piece of content and invited readers to choose the one they felt was the best way to mark that up. The value was in the comments in which people said why they made that choice and debated the options (which means it is THE LAW that you read the preceeding comments before adding your own).

With Dan’s blessing, we’re running an occasional series of HTML5 Simplequizzes. And here’s the second, suggested by a reader named Alohci.

It’s easy to cite works in HTML and default browser stylesheets obey the typographic convention of showing the citation in italics:

<p><q>There was a young man from Nantucket</q> 
wrote John Keats in his <cite>Ode on a Grecian Urn</cite>.</p>

(Although if you also link to an online copy of the work, do you put the link inside the cite element, or the cite element inside the <a>? Oops, that’s another discussion.)

But how do you mark up the author of the work cited — in this case, the text “John Keats”?

Choose from the answers below please. Make sure you show your working out.

A:

<b>John Keats</b>

B:

<i>John Keats</i>

C:

<cite>John Keats</cite>

D:

<span style="font-style:italic">John Keats</span> 
(eg, no semantic element available)

E:

none of the above, and I shall leave a comment to tell you why each of the above is entirely preposterous

Your answers below, please, with your rationale. I’ll wade in on Thursday 14th October.

Note: please DON’T USE ANGLE BRACKETS in your comments. Escape them with &lt; and &gt; or just use [foo] – we’ll know what you mean.

HTML5 Simplequiz #2: citing people originally appeared on HTML5 Doctor on October 8, 2010.

]]>
https://stevefaulkner.github.io/html5doctored/html5-simplequiz-2-citing-people/feed/ 52
HTML5 Simplequiz #1 https://stevefaulkner.github.io/html5doctored/html5-simplequiz-1/ https://stevefaulkner.github.io/html5doctored/html5-simplequiz-1/#comments Fri, 17 Sep 2010 13:30:23 +0000 http://html5doctor.com/?p=2337 A few years ago, Dan Cederholm published a series of articles called Simplequiz in which he posed some options for marking up a specified piece of content and invited readers to choose the one they felt was the best way to mark that up. The value was in the comments in which people said why they made that choice and debated the options.

]]>
A few years ago, Dan Cederholm published a series of articles called Simplequiz in which he posed some options for marking up a specified piece of content and invited readers to choose the one they felt was the best way to mark that up. The value was in the comments in which people said why they made that choice and debated the options (which means it is THE LAW that you read the preceeding comments before adding your own).

With Dan’s blessing, we’re beginning an occasional series of HTML5 Simplequizzes. And here’s the first.

Consider a products page on a website. It might be a page showing widgets, HTML5 books or Remy’s favourite nose hair removers. What’s the best way to mark up the products?

Note: please DON’T USE ANGLE BRACKETS in your comments. Escape them with &lt; and &gt; or just use [foo] – we’ll know what you mean.

A:

<div>
<h2>Groom Mate Platinum Xl Nose & Ear Hair Trimmer by Groom Mate</h2>

</div>
<div> <h2>Philips NT9110 Nose Hair Trimmer by Philips<h2> ... </div>

B:

<article>
<h2>Groom Mate Platinum Xl Nose & Ear Hair Trimmer by Groom Mate</h2>
...
</article>
<article> <h2>Philips NT9110 Nose Hair Trimmer by Philips<h2> ... </article>

C:

<section>
<h2>Groom Mate Platinum Xl Nose & Ear Hair Trimmer by Groom Mate</h2>
...
</section>
<section> <h2>Philips NT9110 Nose Hair Trimmer by Philips<h2> ... </section>

D:

<nav>
<div>
<h2>Groom Mate Platinum Xl Nose & Ear Hair Trimmer by Groom Mate</h2>
...
</div>
<div> <h2>Philips NT9110 Nose Hair Trimmer by Philips<h2> ... </div> ... </nav>

Your answers below, please, with your rationale.

HTML5 Simplequiz #1 originally appeared on HTML5 Doctor on September 17, 2010.

]]>
https://stevefaulkner.github.io/html5doctored/html5-simplequiz-1/feed/ 116