HTML tag
An HTML tag is part of the World Wide Web markup language HTML, denoting the start and end of an element, and, through its attribute values, sets properties of that element.For instance, the <em> tag begins an EM element (used for marking emphasized text). (The user agent may choose how to indicate this emphasis.) Where an element is not empty (such as a line break or horizontal rule), an opening tag should be matched with a corresponding "end" tag, which is identical to the opening tag except that it begins with a slash (i.e. </em> for the emphasis tag).
| Table of contents |
|
2 The document type definition (DTD) 3 List of HTML tags 4 External links |
Syntax
Note that HTML, but not XHTML, through some SGML features ("SHORTTAG") allows various abbreviated notations, which make the following equivalent:<element-name attribute-name="attribute-value">content</element-name>
<ul>
<li>Foo</li>
<li>Foo</>
<li>Foo
<li/Foo/
<>Foo
</ul>Furthermore the trailing angle bracket can be omitted when another opening one directly follows (<code><li<em>Foo</em</li></code).
If an attribute can only take predefined values, the attribute name itself and the equals sign can be omitted (<p left>); when the only valid value is called the same as the attribute, you get "binary attributes" (<dl compact> = <dl compact="compact">).
Web browser support for these features is very limited, though, and this may or may not work at all in your web browser. Do not rely on this behaviour, instead always write full tags and attributes, and quote any attribute values.
Some of the common tags used in HTML are:
- ... - opens the HTML code
-
... - gives the text to be displayed in Title Bar - ... - holds the actual content in the HTML page
- ... - tag to hold a hyperlink
- - used to insert programs into the document such as JavaScript or VBScript
- - used to create forms for user interaction
All HTML documents should start with a Document Type Definition (or DTD) declaration. This is one of the following:
The document type definition (DTD)
Used for documents which are purely structural, leaving formatting to Cascading Style Sheets.
<u>, <strike>, bgcolor="", align="" and so forth. Specifying a "transitional" document type can sometimes also lead to different behaviour in Web browsers to accommodate common practices in browsers before the advent of CSS.