HTML5 Guidelines for Web Developers

(coco) #1

32 Chapter 2—Structure and Semantics for Documents


NOTE

Be careful when writing boolean attributes in HTML5: true or false are not
valid attribute values! As soon as the parser discovers the attribute name in
boolean attributes, it switches to true. So there are three valid notations for
setting a boolean attribute to true:

<time pubdate>
<time pubdate="">
<time pubdate="pubdate"> (of course you can also omit the quotation marks)

To switch to false, you only have one option: Omit the attribute altogether!

2.7.3 The “mark” Element


The mark element represents a highlighted text segment that is regarded as rel-
evant in a different context. That sounds a bit cumbersome, so we will illustrate
it with some brief examples: If you want to highlight a certain passage of a quota-
tion in particular, you change the original text and almost force a new meaning
onto it. You can use the mark element to add significance to certain words in a
document or code listing as a result of searching for them or in the course of
interpreting the code.

2.7.4 The “wbr” Element


Unsurprisingly, the wbr element enables the browser to insert an optional line
break in long words. For example, inserting a couple of wbr elements in a rather
long word, such as supercalifragilisticexpialidocious, would give the browser the
opportunity to break the word over two lines if the layout requires it:

supercali<wbr>fragilistic<wbr>expialidocious

It depends entirely on the layout whether and where the line break occurs. wbr
only allows a line break, it does not force it. Possible applications would be long
URLs or code listings. Similar to br, wbr is a so-called void element, which means
it must not contain an end tag—a quality it shares with 14 other elements in
HTML5. Here they are

area base br col command embed
hr img input keygen link meta
param source wbr

But of course void elements can contain a slash in the start tag itself (e.g.,
<br />), which is useful with regard to meeting the requirements of valid
XHTML5 documents.
Free download pdf