You are here: Reference > HTML
HTML & XHTML (Hyper Text Markup Language)
Dottoro provides you a complete HTML & XHTML reference with examples, browser support information, syntax and more.
You can find help on both cross-browser and browser-specific elements, attributes,
events and HTML standards like entities, character sets,
language codes, color names and more.
XHTML and HTML
XHTML is similar to HTML, they contain the same elements, but XHTML must be a well-formed XML while HTML is based on SGML.
The structure of XML and HTML documents is the same, but their syntax is different:
- Element names, attribute names and values are case-sensitive in XML and case-insensitive in HTML.
- Elements must always be closed in XML while in HTML it depends on the type of the element.
- Attributes must always have a value in XML while it is not required in HTML.
- Attribute values must be enclosed in double or single quotes in XML while it is not required in HTML.
Document Type Definition (DTD)
The rules of an HTML page depends on its document type declaration.
The DTD specifies the syntax of the document and affects the visual appearance of the page.
In HTML and XML the !DOCTYPE element can be used to specify the DTD for the document.
Each HTML and XML document can have only one !DOCTYPE element and it must be placed
before the root element (the html element in HTML documents) of the document.
For a list of DTDs please see the page for the !DOCTYPE element.
If you use one of the XHTML document types, your HTML document becames XHTML.
We recommend the use of the following XHTML document type:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
HTML & XHTML elements
HTML elements (consisting of "tags" surrounding by angle brackets (<, >) ) are the basic components for HTML markup.
The root element of an HTML document is the html element and there are two main sections under
the root element, the head and the body section.
In the head section you can specify the document title, styles,
scripts, imported files, meta information and several
other information about the document, and the visible content of the document is placed in the body section.
- In HTML, every element must have a start tag / opening tag (<div>) and in most cases, an end tag / closing tag (</div>). For some elements, the closing tag is not required (e.g. option) and it is forbidden (e.g. br). In XHTML, elements must always be closed.
- Element names are case-insensitive in HTML, and case-sensitive in XHTML.
Use lower-case characters in element names and always close every element (<option />, <br />).
The appearance, behavior and contents of an HTML element depends on its type, attributes, style settings (see CSS) and the
subtree of the document that belongs to the element, furthermore these properties can be modified dynamically with JavaScript.
For a complete list of HTML tags, please see the page for HTML elements.
HTML & XHTML attributes
An attribute is a name/value pair separated by an equal sign (=) that is placed within the start tag:
<element attributeName1="value1" attributeName2="value2"> content </element>
- In HTML documents, attribute names are case-insensitive, some attributes have no value (e.g. checked) and attribute values need not be enclosed in single or double quotes.
- In XHTML documents, attribute names are case-sensitive and every attribute must have a value and it must be enclosed in quotes.
Use lower-case characters in attribute names, specify a value for each attribute and enclose each attribute value in
single or double quotes.
There are some common attributes that are supported by every HTML element (e.g. id, class,
style, title), support for other attributes is element dependent.
If you need a complete list of HTML attributes, see the page for HTML attributes, for the tags that
support an attribute, see the 'Supported by tags' section on the page for the attribute, for the attributes
that are supported by an element, see the 'Possible members' section on the page for the element.
There are some special attributes in HTML:
- With the style attribute you can assign inline style settings to an element. For further details, see the pages for the style attribute and CSS (Cascading Style Sheets).
- With event attributes you can register handlers for events occurring on an element. If you need information about the event registration techniques, see the page for the event object and the page for event handling in JavaScript.
Related sites:
- HTML tags
- HTML attributes
- HTML events
- Entity and numeric character references
- Character sets
- Language codes
- MIME types
- Colors
External links:
User Contributed Comments