XHTML "tags", "elements", and "attributes"

Tags

pic highlighting Tags

The term, strictly speaking, refers to the < and > symbols and what's in between them. The first one, which may contain attributes, is called an open tag. The last one is called a closing tag. Refer to the above image.

Elements

pic highlighting Elements

The term "element" refers to the opening tag, the closing tag, and everything inbetween. Yes, elements can have other elements nested inside them.

Attributes

pic highlighting Elements

Attributes, if present, are always found in the opening tag of an element (or simply in the tag of an empty element). Attributes represent traits of the element. In the above example the src attribute is set to the path of an image. The alt attribute is a short description of the image. Note that in addtion just the name there is a value associated. This value is always in quotes and the two are joined with an equal-sign, =, as above.

Required Attributes: A fair number of elements have required attributes. Required attributes must always be provided in the opening tag.

Back to Knowledge Dump