<br> and <strong>


#1

When I tried using <br> instead of the suggested <br />, the outcome was the same, but typing <br> is shorter, can’t I just use <br> instead? And can’t I just use <b> instead of <strong>?


#2

When XHTML came onto the scene around 1999 it was HTML’s effort to become XML conforming. XML does not allow ‘void’ elements and the working group authors did not want to create closing tags for elements that previously did not have them.

<br>
<hr>
<img>
<input>
<col>
<area>
<link>
<meta>
<param>
<base>

(not exhaustive but I think most are there)

The above are HTML 4.01 tags. The authors decided that rather than creating a closing tag, they would make them self-closing by inserting a closing slash, so

<br>

became,

<br/>

and so on. Unfortunately there was a snag… This did not work in IE5 for the Mac. Somebody (can’t say who) discovered that inserting a space cured the problem so it was adopted in the XHMTL spec.

Fifteen years passed before any considerable change to spec occurred, and by then (2005) browsers had come a long way toward assimilation and IE being the biggest culprit had begun to fall in line with the rest of the vendors so the spec could become more uniform and universal.

It still took another ten years for this to come to fruition but now HTML5 has matured into the standard for the web. Now HTML is a living language that will continue to evolve, but now with the support of all vendors, including IE 11 (almost) and Edge (mostly).

Now the only concern for publishers is what MIME type the document is being served out with. text/html or application/xml, the latter being XML conforming. We don’t need to be that focused since for the most part all of our pages are being served as text.

In the looser form (text/html) we do not need to include the slash in our void elements.

<br>

is valid HTML5 as long as the type is “text/html”, which it is by default if not specified.

HTML5 also accepts the slash with or without a preceding space (and IE for Mac is no longer choking on it), so all of the following are valid…

<br>
<br/>
<br />

Good question. The answer depends on whether you want to indicate change of voice for users of screen readers.

<b></b>
<i></i>

are valid elements, but they offer no change of voice, only visual change that sighted users can see. We should not exclude assistive technology users from the semantics of our documents, so if a change of voice would be suitable, or recommended then we would use,

<strong></strong>
<em></em>

This will give the user a chance to pick up on the semantics of emphasis. The above are called semantic elements for this reason. They give a change of voice that alters or emphasiizes the meaning slightly when read aurally.

If all we want is bold text that does not alter or emphasize, then use <b></b> (bold text) and <i></i> (italics). Do not use <strong></strong> for bold text unless you wish to include the semantics; and, likewise do not use <em></em> just for italics, again unless you wish to include the semantics.


#3

Search engines are blind, so must be given semantic clues when disseminating our pages. That is the goal of the document outline, for starters, but also of the semantic elements to help in parsing our document’s true meaning and message.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.