This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
notes:html_cheat_sheet [2026/06/11 01:39] 8.222.235.254 old revision restored (2026/06/05 10:35) |
notes:html_cheat_sheet [2026/06/13 20:25] (current) 216.73.216.69 old revision restored (2026/06/12 06:20) |
||
|---|---|---|---|
| Line 11: | Line 11: | ||
| * A simple HTML web page | * A simple HTML web page | ||
| <code html> | <code html> | ||
| - | < | ||
| < | < | ||
| - | | + | < |
| - | <body background=url> | + | <body background=url> |
| </ | </ | ||
| </ | </ | ||
| Line 31: | Line 30: | ||
| ==== HTML Components ==== | ==== HTML Components ==== | ||
| * HTML documents are text files consisting of HTML elements. | * HTML documents are text files consisting of HTML elements. | ||
| - | * HTML elements are defined using HTML tags. [[http:// | + | * HTML elements are defined using HTML tags. |
| * HTML tags contain the element name surrounded by angle brackets (** < > **). | * HTML tags contain the element name surrounded by angle brackets (** < > **). | ||
| * HTML tags normally come in pairs - the **start tag**(< | * HTML tags normally come in pairs - the **start tag**(< | ||
| Line 38: | Line 37: | ||
| * Attribute values should always be either single or double-quoted. | * Attribute values should always be either single or double-quoted. | ||
| * Element and attribute names are not sensitive but lowercase names are recommended and required in XHTML. | * Element and attribute names are not sensitive but lowercase names are recommended and required in XHTML. | ||
| - | * [[http:// | ||
| ==== Formatting Tags ==== | ==== Formatting Tags ==== | ||
| Line 120: | Line 118: | ||
| ==== Character Entities ==== | ==== Character Entities ==== | ||
| - | * A character entity represents a single character. [[http:// | + | * A character entity represents a single character. [[http:// |
| * It consists of an ampersand (&), an entity name or a # and an entity number, and finally a semicolon (;) (e.g. <). | * It consists of an ampersand (&), an entity name or a # and an entity number, and finally a semicolon (;) (e.g. <). | ||
| * Common character entities include: > , < , (space), " , ' . | * Common character entities include: > , < , (space), " , ' . | ||
| * Other common symbols include: cent ¢, pound £, yen ¥, euro €, copy ©, times ×, div ÷, reg ®, sect § | * Other common symbols include: cent ¢, pound £, yen ¥, euro €, copy ©, times ×, div ÷, reg ®, sect § | ||
| - | * Non-standard letters and other characters can be displayed url-encoded using [[http:// | ||
| - | ==== HTML Head ==== | + | ==== Advanced |
| - | * The head element of a page is not displayed. It contains information about the document. | + | |
| - | * It may only contain the following tags: base (base url for links), link (external resources e.g.style-sheets), | + | |
| * Example style declaration in head <code html> | * Example style declaration in head <code html> | ||
| < | < | ||
| Line 136: | Line 131: | ||
| </ | </ | ||
| </ | </ | ||
| + | * <div> and < | ||
| + | * The head element of a page is not displayed. It may only contain the following tags: base (base url for links), link (external resources e.g.style-sheets), | ||
| * Examples of the meta tag <code html> | * Examples of the meta tag <code html> | ||
| <meta name=" | <meta name=" | ||
| Line 142: | Line 139: | ||
| <meta http-equiv=" | <meta http-equiv=" | ||
| </ | </ | ||
| - | |||
| - | ==== Advanced HTML ==== | ||
| - | |||
| - | * <div> is used to group elements or divide a page into sections. < | ||
| - | * A simple script in a webpage <code html> | ||
| - | < | ||
| - | <script type=" | ||
| - | <!-- //to prevent display in older browsers | ||
| - | document.write(" | ||
| - | //--> | ||
| - | </ | ||
| - | < | ||
| - | </ | ||
| - | * An object element with child param elements can also be used to embed content. | ||
| - | * accesskey (character) and tabindex (integer) attributes can be used to make a page keyboard-friendly. | ||
| - | |||
| - | * Events allow scripts to be registered for certain user actions. There are four types of events : | ||
| - | * window events are only valid in a body or frameset element: onload, onunload. | ||
| - | * form element events: onchange, onselect, onreset, onsubmit, onblur, onfocus | ||
| - | * keyboard events: onkeydown, onkeypress, onkeyup | ||
| - | * mouse events: onclick, ondblclick, onmousedown, | ||
| - | |||
| - | ==== XHTML ==== | ||
| - | * XHTML is a stricter and cleaner replacement for HTML defined as an XML format. | ||
| - | * XHTML requires elements to be closed, properly nested and lowercase. | ||
| - | * Documents must have a DOCTYPE declaration and only a single root element. They must have a head with a title and a body. | ||
| - | * Attributes must be lowercase with quoted values and must have values (e.g. checked=" | ||
| - | * id replaces the name attribute, xml:lang replaces lang but both should be used for compatibility. | ||
| - | * There are three XHTML variations | ||
| - | * Strict - No presentational attributes allowed <code html> | ||
| - | < | ||
| - | PUBLIC " | ||
| - | " | ||
| - | * Transitional - Presentational attributes allowed but no frames <code html>< | ||
| - | PUBLIC " | ||
| - | " | ||
| - | * Frameset - Allows presentational attributes and frames <code html> | ||
| - | < | ||
| - | PUBLIC " | ||
| - | " | ||
| - | |||
| - | |||