HTML and CSS Reference
In-Depth Information
Breaking lines: br and wbr
The line break element,
br
(rendered as
<br>
or
<br />
, because it's self-closing)
is typically used in content where a new line is an expected part of the content format,
such as is the case with a postal address or poem. The
City Press
uses this in the footer
section for the postal address:
<p>
<b>The City Press</b><br />
123 General Street<br />
Springfield, OH 45501
</p>
The other line breaking element,
wbr
(or
<wbr />
), is new in HTML5. It defines
where in a word it would be OK to break to a new line if space didn't permit the whole
word. In the
City Press
web page, a company named
IrrigationDirect
(all one word) is
mentioned. This is a perfect candidate for the
wbr
element, because the HTML can in-
struct the browser to break the name in the middle if need be, and the name will still
make sense. Here's the code:
<i>Irrigation<wbr />Direct</i>
Other text-level elements
This section covers a few stragglers that didn't get used in the
City Press
web pageālet's
briefly run through them anyway!
Title of a work: cite
The
cite
element represents the title of a work such as a book, song, film, TV show,
a painting, and so on. We've already encountered the
cite
attribute, used within the
blockquote
element to attribute a source to the quote, but there is also a
cite
ele-
ment to contain stand-alone references not associated with any particular element or
citations of other material. Most user agents will display a citation in italic font, a typo-
graphic convention you'll often see in the print world as well.
Formatting computer I/O: code, var, samp, kbd
The
code
,
var
,
samp
, and
kbd
elements are all unchanged from the prior HTML
specification. They define a fragment of computer code, a variable, sample output from
Search WWH ::
Custom Search