HTML and CSS Reference
In-Depth Information
pages standards compliant and fully semantic, and helps guarantee they will be rendered as
we wish.
BAD CODE
Click here to view code image
1. <html>
2. <h1>Hello World</h1>
3. <p>This is a web page.</p>
4. </html>
GOOD CODE
Click here to view code image
1. <!DOCTYPE html>
2. <html>
3. <head>
4. <title>Hello World</title>
5. </head>
6. <body>
7. <h1>Hello World</h1>
8. <p>This is a web page.</p>
9. </body>
10. </html>
Keep the Syntax Organized
As pages grow, managing HTML can become quite a task. Thankfully there are a few quick
rules that can help us keep our syntax clean and organized. These include the following:
Use lowercase letters within element names, attributes, and values
Indent nested elements
Strictly use double quotes, not single or completely omitted quotes
Remove the forward slash at the end of self-closing elements
Omit the values on Boolean attributes
Observing these rules will help keep our code neat and legible. Looking at the two sets of
HTML here, the good code is easier to digest and understand.
BAD CODE
Click here to view code image
1. <Aside>
2. <h3>Chicago</h3>
3. <H5 HIDDEN='HIDDEN'>City in Illinois</H5>
4. <img src=chicago.jpg alt="Chicago, the third most populous city
Search WWH ::




Custom Search