Saturday, August 29, 2009

Basic Notes - Useful Tips

Basic Notes - Useful Tips
When you write HTML text, you can never be sure how the text is displayed in another browser. Some people have large computer displays, some have small. The text will be reformatted every time the user resizes his window. Never try to format the text in your editor by adding empty lines and spaces to the text.
HTML will truncate the spaces in your text. Any number of spaces count as one. Some extra information: In HTML a new line counts as one space. 
Using empty paragraphs
to insert blank lines is a bad habit. Use the
tag instead. (But don't use the
tag to create lists. Wait until you have learned about HTML lists.)
HTML automatically adds an extra blank line before and after some elements, like before and after a paragraph, and before and after a heading.
We use a horizontal rule (the

tag), to separate the sections in our tutorials.

More Examples
More paragraphs
This example demonstrates some of the default behaviors of paragraph elements.
html>

This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.


This paragraph
contains      a lot of spaces
in the source     code,
but the    browser
ignores it.


The number of lines in a paragraph depends on the size of your browser window. If you resize the browser window, the number of lines in this paragraph will change.

Line breaks
This example demonstrates the use of line breaks in an HTML document.

To break
lines
in a
paragraph,
use the br tag.

Poem problems
This example demonstrates some problems with HTML formatting.

   My Bonnie lies over the ocean.
   My Bonnie lies over the sea.
   My Bonnie lies over the ocean.
  Oh, bring back my Bonnie to me.

Note that your browser simply ignores your formatting!

Headings
This example demonstrates the tags that display headings in an HTML document.

This is heading 1


This is heading 2


This is heading 3


This is heading 4


This is heading 5

This is heading 6

Use heading tags only for headings. Don't use them just to make something bold. Use other tags for that.

Horizontal rule
This example demonstrates how to insert a horizontal rule.
The hr tag defines a horizontal rule:



This is a paragraph



This is a paragraph



This is a paragraph

Hidden comments
This example demonstrates how to insert a hidden comment in the HTML source code.
This is a regular paragraph


Basic HTML Tags
If you lookup the basic HTML tags in the reference below, you will see that the reference contains additional information about tag attributes.
You will learn more about HTML tag attributes in the next chapter of this tutorial.
Tag
Description
Defines an HTML document
Defines the document's body

to


Defines header 1 to header 6

Defines a paragraph
Inserts a single line break


Defines a horizontal rule
Defines a comment

No comments:

Post a Comment