• Stick with lowercase
Although HTML5 is case insensitive, HTML4 requires all tags and attributes to be lowercase. We suggest
using lowercase to avoid any potential issues with backwards compatibility.
• Use quotes for values
Attribute values must be placed in between straight quotation marks.
• Observe proper spacing
A single space is allowed between elements and their attributes. No space should exist between a tag and the brackets that surround it.
• Nest with care
Whenever you use one HTML element inside of another, this is called nesting. When doing so, make sure to always close the most recently opened element before another. For example, in the following code snippet, the link is nested inside the paragraph, so the closing link tag must come before the closing paragraph tag.
<p><a href=”link.html”>Link text</a>
and then the rest of the paragraph.</p>One final note about coding styles: Many developers indent certain lines of code. This is not a requirement
from HTML standards but rather a personal option. Throughout the rest of this chapter, we indent some lines of code to help clarify the page structure, not for the sake of the browsers, but to make it easier for us humans to read the code.
Post a Comment