Section 2: Document Markup

Chapter 18: Tags to Avoid

 Now that we have focused on the new features of HTML5 and warned about the inefficient methods developers resorted to in the past, let us take a look at a few other tags and methods to avoid using in our code.While some of these are already deprecated, not all are, and they all take away from our goals of separating structure from style and responsive design.

<b>, <i>, <strong>

All of these place emphasis on text, and can be replaced with CSS. Using these within your code means a change to your CSS style will not necessarily determine whether or not the style of text is affected for content wrapped in these tags. It also means you have to edit style in two places, both your CSS and HTML files.

<font>

Again, we can control font (with even more control) using CSS, and hard coding your font into your page can override what you wanted in your CSS.

<br>

I know, I have (and will) use breaks in my examples. What I mean to discourage here is using breaks as a quick fix when you should be using <p> or something more appropriate. If another tag better identifies your content, but you do not want some of the automatic styling that comes with the tag, we can override those attributes in our CSS, so use the best tag for your content. We will see how to adjust it to your needs when we look at CSS later.

Styling Attributes

Just like not using tags that style in our HTML, we should avoid using attributes that affect page appearance as well, like aligning content, or applying borders, colors, and other CSS elements.

License

Icon for the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

Chapter 18: Tags to Avoid by Michael Mendez is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.