Should book titles be contained in an <em> tag? If not <em> is there more appropriate markup?
Grammar rules state that book titles (or the titles of other "long" works) should be italicized or underscored. Therefore, the tag is appropriate.
I would use RDFa with any tag. The RDFa specificaton allow you to add some semantic in your HTML. for example your titles would be annotated with the Dublin-Core property dc:title.
For something like a book title that conveys semantic information, the answer is no. You should do something like:
<span class="BookTitle">War and Peace</span>
and then use CSS to style BookTitle
as you please.
It really depends on the context.. They might even use <h1-6>-tags depending on how and where you display the book titles. If you display it in a list of books, you could use a definition list with the <dt> tag as the book title, and <dd> tag(s) for the author(s).
There is really no "semantically correct" tag for a book, but you can create a markup that is easy to read and makes sense.
<dl class="booklist">
<dt class="book">Book title</dt>
<dd class="author">The author</dd>
<dt class="book">Awesomest markup Evah!</dt>
<dd class="author">HTML Wiz Kid</dd>
<dd class="author">Tagz are Me</dd>
</dl>
Doubt so. Semantically "em
" means "emphasis" not "italics".
Well, HTML lacks a lot of things, so I'd either just use generic <span class="book-title">Foobar</span>
or if I'll feel a crazy I'll just invent my own tag (who said I can't? it will validate perfectly with customized DTDs or I may use XSLT to transform the document).
Concerning tags like <em>
and <strong>
, w3schools.com states that "They are not deprecated, but it is possible to achieve richer effect with CSS." So I would say that it is appropriate for a book title unless you prefer using CSS for all text formatting (as I do).
<em> is definitely wrong. In addition to the other suggestions given before me such as RDFa or a semantic class name, consider using <cite>
From the HTML 5 draft:
The cite element represents the title of a work (e.g. a book, a paper, an essay, a poem, a score, a song, a script, a film, a TV show, a game, a sculpture, a painting, a theatre production, a play, an opera, a musical, an exhibition, etc). This can be a work that is being quoted or referenced in detail (i.e. a citation), or it can just be a work that is mentioned in passing.