Sunday, October 18, 2009

HTML Attributes

Nested HTML Elements

Most HTML elements can be nested (can contain other HTML elements).
HTML documents consist of nested HTML elements.

The example above contains 3 HTML elements.

HTML Element Syntax

  • An HTML element starts with a start tag / opening tag
  • An HTML element ends with an end tag / closing tag
  • The element content is everything between the start and the end tag
  • Some HTML elements have empty content
  • Empty elements are closed in the start tag
  • Most HTML elements can have attributes

HTML Elements

HTML documents are defined by HTML elements.

An HTML element is everything from the start tag to the end tag:
* The start tag is often called the opening tag. The end tag is often called the closing tag.

HTML Images

HTML images are defined with the img tag.


Note: The name and the size of the image are provided as attributes.

HTML Links

HTML links are defined with the a tag.




Note: The link address is provided as an attribute.

HTML Paragraphs

HTML paragraphs are defined with the p tag.


HTML Headings

HTML headings are defined with the h1 to h6 tags.


HTM or HTML Extension?

When you save an HTML file, you can use either the .htm or the .html extension. We use .htm in our examples. It is a habit from the past, when the software only allowed three letters in file extensions.

With new software it is perfectly safe to use .html.

Editing HTML

In this tutorial we use a plain text editor (like Notepad) to edit HTML. I believe this is the best way to learn HTML.

However, professional web developers often prefer HTML editors like FrontPage or Dreamweaver, instead of writing plain text.

What you Need?

You don't need any tools to learn HTML.
  • You don't need any HTML editor
  • You don't need a web server
  • You don't need a web site

HTML Tags

HTML markup tags are usually called HTML tags


  • HTML tags are keywords surrounded by angle brackets

  • HTML tags normally come in pairs

  • The first tag in a pair is the start tag, the second tag is the end tag

  • Start and end tags are also called opening tags and closing tags

example:


What is HTML?

HTML is a language for describing web pages.
  • HTML stands for Hyper Text Markup Language
  • HTML is not a programing language, it is a markup language
  • a markup language is a set of markup tags
  • HTML uses markup tags to describe web pages

Get Started

To start with, click START button, PROGRAMS, ACCESSORIES, then NOTEPAD. Notepad is where we create & edit our HTML design. Type in the sample tags below.


After feeding these tags through the notepad, save this as mainpage.htm or you use your name extended with html, like roy.htm. After saving it, an icon will appears in My Documents folder or anywhere where you saved it with an icon of your default web browser like mozilla firefox or internet explorer. The purpose of a web browser is to read HTML documents and display them as web pages. Double click it open and view your first HTML.