Comments, Rules, Line Breaks

A few more minor extras can be added to help spice up your site and html code. Comments, line breaks, and horizontal rules can separate content.

Comments

Hopefully you've been following along with each of these examples and have been incorporating them into your site. Hand-coding HTML (or any other language) can be confusing, especially if the code is sloppy. It always helps to document what you're doing in case you need to come back to it months from now. This way, you don't have to remember just what size that table is, or where the navigation of your site begins. Comments begin with a '!--' set and end with '--'.

A typical comment may something like this:
<html> <head> <title>HTML for Beginners - Basic HTML</title> </head> <body> <!-- This is an HTML comment --> </body> </html>

Line Breaks

We covered preformatted text earlier, but what if you just need to force a line break in a single sentence. You don't want to have all the whitespace output. In this case you can use the line-break element to force a new line.

A typical line break may look something like this:
<html> <head> <title>HTML for Beginners - Basic HTML</title> </head> <body> <p>Some text here.<br /< and more text here.</p> </body> </html>

And will produce

Some text here.
and more text here.

Horizontal Rules

Sometimes line breaks aren't enough to distinguish new areas of content. You can use horizontal rules to draw a thin line across the page and create groupings of content.

A typical horizontal rule may look something like this:
<html> <head> <title>HTML for Beginners - Basic HTML</title> </head> <body> <hr /< </body> </html>

And will produce


«...Tables Tag List...»

Advanced Tips

You should never use multiple line breaks to force multiple-spacing between elements. You can instead use CSS to change the margins or padding between different paragraphs, divs, or other block-level elements.