Home - Help & Support - Contact Us
    

Clean HTML Code And Comments

Clean Code
Clean code means that your HTML coding follows all specifications. 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...  
     
  • 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>.
     
  • 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. For Example, it will not render correctly in Navigator 4.0 Beta1, Netscape purposefully built into the browser so developers could catch errors. 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 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 -->.


Your own HTML page
Add the following to your HTML page ("Home.htm"): (the blue text is what to add)

<html>
<head><title>My Home Page</title></head>
<!-- The body starts here - and a background image is loaded -->
<body realsrc="bgnd.gif" background="http://www.zeronese.net/knowledge-base/admin/bgnd.gif">

<!-- This is a heading, in blue -->
<center><font color="Blue"><h1>YOURNAME's Home Page</h1></font></center>
<!-- This is a horizontal line -->
<hr>
<!-- My name and the two images are all part of a link - which is a "mailto" link -->
This is the home page of <a href="mailto:YOUR EMAIL ADDRESS"><img src="bullet.gif" border=0><b>YOURNAME</b>.<img src="bullet.gif" border=0></a>
<p>Type something about yourself here. Describe briefly who you are and what you do for a living. Remember to use bold and italic text, for emphasis.</p>
<hr>
<h2>My favourite Web Sites</h2>
<br>

<!-- This list is an unordered list -->
<ul>
<li> <a href="http://www.xencon.com">Xenon Web Design</a> </li>
<li> <a href="http://www.microsoft.com">Microsoft</a> </li>
<li> <a href="http://www.sybase.com">Sybase</a> </li>
<li> <a href="http://www.sybase.co.za">Sybase South Africa</a> </li>
</ul>
 

</body>
</html>


Save the text file as "Home.htm" and test to see results.
 

Rated:NR/0 Votes
554 Views
More Articles From HTML
More Articles From HTML
Print Article
Print
Share |
Comments, Questions & Reviews
#1 Comment by: Brett
2008-02-20 22:37:27
 
well you are not supposed to use the <b> tag anymore it is now <strong> italics is <em> just a note in semantically coded and compliant designs.



Comments is currently disabled for this article!
Related Articles and Readings
Navigation Within An HTML Document
Navigation Within An HTML DocumentWouldn't it be nice to be able to click a link and move to another area ...
Lists in HTML
The UNORDERED LISTThe Unnumbered List is the first of the three types of lists. This is probably the most common ...
Links and Images in HTML
Anchored LinksWithout Links, the World Wide Web wouldn't be a web at all! To add a link... you will use ...
What Server Objects are Supported on Windows Shared Hosting Servers?
Below is a list of all the Server Objects supported on our Windows shared hosting servers. You can use these ...
Critical paths for your Linux Dedicated or Virtual Dedicated Server
The file directory on your Linux dedicated/virtual dedicated server contains a number of critical paths that house applications, language frameworks, ...
The information provided in this article is for general information and/or the comments is the sole responsibility of their respective authors and does not necessarily reflect the opinion of zeronese.net does not endorse any article and/or comments published by our web users unless otherwise noted.