$$$ Learn how to Make Money with your Website
<Table of Contents>
FatCow $3.15/mo. Plan - Click Here for Moo Details! Learn HTML5 Today!
>>
- Bob's HTML Course - Take HTML5 Lessons - Twitter - Dave's Blog - Learn on your iPad
Web Hosting HTML Tutorial CSS Tutorial Web Design Tutorial Hosting under

HTML Code MiniChapter 6: Clean Code, Comments, and Escape Codes

HTML Tutorial Chapters:  

iPage Hosting $95 Plan on sale today for $1.89/mo
Click Here for More Details!

I have a new 5-star iPad Course: Web Design Basics.   Download your copy now from AppStore.
Web Design Basics covers both HTML and CSS together in one interactive guide.   Get it Now!

Clean HTML Code...

< back to the previous chapter

Clean code means that your HTML coding follows all specifications, I personally don't use true clean code, but very close to it. Here are a few ways to keep your code clean:

  • Don't type special characters into your code, instead type their escape code... many characters should NEVER be typed directly into HTML code... for example the "<", ">", the "©", "&", and the " itself. Instead, type &escape_code; (Ampersand, Escape Code for Character, then a semicolon). For these 5 characters, here are the escape codes...
    • For the < type &lt;
    • For the > type &gt;
    • For the © type &copy;
    • For the & type &amp;
    • For the " type &quot;
  • Use quotes around values in attributes... For example, if you want a horizontal rule that is half of the screen width, type <hr width="50%"> rather than <hr width=50%>, or if you want one that is size 5 type <hr size="5"> rather than <hr size=5>. Isn't it ironic that I don't? <g>

  • Don't overlap tags... Overlapping occurs when Tag A starts, Tag B starts, Tag A closes, then Tag B closes. This will cause errors in sensitive browsers.
Examples:
  • Wrong Way (Overlaps):
    <font size=+1><b>This is Bold and One Font Size Bigger</font></b>
    Right Way (Doesn't Overlap):
    <font size=+1><b>This is Bold and One Font Size Bigger</b></font>
  • Wrong Way (Overlaps):
    <a href="here.html"><i>This link is italicized</a></i>
    Right Way (Doesn't Overlap):
    <a href="here.html"><i>This link is italicized</i></a>


The HTML Comment Tag...

If you are writing an HTML document, sometimes you may want to put little reminders to yourself with your code so that you will be able to interpret your coding better. A comment will not appear in a web browser when the page is displayed... it is only visible when the source code is viewed. You start commented text with <!-- and end it with -->.

HTML Code - Try it Yourself!

In the Box below, type the following HTML code, then click "Check it Out!" The HTML document you made will be displayed in your browser. You may wish to change the words within the tags just to try it out.

Try typing this:



<html>
<head><title>TITLE HERE</title></head>
<body>
<!-- No one will see this really long comment I have typed right here unless they decide to view the source. -->
This page Copyright &copy; davesite.com.

</body>
</html>



Get the Latest Phones at TracFone Wireless! View Today's Phone Deals!
Hosting CompanySpecial FeaturesHost DetailsDisk Space/
Bandwidth
Domain PricePrice (Click for More)
iPage Expert
Web Hosting
"Best Control Panel Ever"/
Enhanced Security/100% Green
Unlimited/UnlimitedFree (ever year) $8.49/mo $1.89/mo
1&1 Hosting Enhanced Security (SSH)/
Scripting, and IMAP Secure Email
250GB/Unlimited 3 Free (every year) $9.99/mo

HTML An Interactive Tutorial
Continue Next Chapter