Concise comments should be single-lined, such as:
<!– This is a comment –> |
Multi-line comments should be formatted as follows:
<!– This is a long comment example. This is a long comment example. This is a long comment example. This is a long comment example. –> |
Long comments are more readable when they are indented with two spaces for clarity.
Simplify linking to style sheets by omitting the type attribute.
<link rel=”stylesheet” href=”styles.css”> |
Short CSS rules can be compressed for brevity, like so:
p.intro {font-family:Verdana;font-size:16em;} |
For lengthy CSS rules, it’s advisable to spread them across multiple lines:
body { background-color: lightgrey; font-family: “Arial Black”, Helvetica, sans-serif; font-size: 16em; color: black; } |
Ensure consistency in CSS formatting:
Simplify the syntax for loading external scripts by omitting the type attribute.
<script src=”myscript.js”> |
Employing messy HTML code may lead to JavaScript errors.
These two JavaScript statements yield distinct outcomes:
Example
getElementById(“Demo”).innerHTML = “Hello”; getElementById(“demo”).innerHTML = “Hello”; |