| HTML Summary |
|
This is an excerpt for HTML 4, not particularly suited as a beginners guide.
| [ phrase ] | an optional phrase | |
| { text } | comment | |
| «term» | non-terminal term, to be substituted |
| <HTML [ lang="en" ] > | ||
| <HEAD> | { Header section } | |
| [ <META ... > ] | See immediately below | |
| <TITLE>HTML Overview</TITLE> | { Page title } | |
| [ <STYLE ... > ] | { See section Style below } | |
| </HEAD> | ||
| <BODY> | { Body section } | |
| «elements forming the page contents» | { see section Elements below } | |
| </BODY> | ||
| </HTML> | ||
The meta element provides information about the page (not about its subject). Attributes are: name (or http-equiv), content and optionally scheme (lang, one of the general attributes, is also applicable). There is no prescribed set of name and content values, but HTTP-servers, search engines and browsers may respond to particular values.
Examples of Meta-statements:
The page (body) is commonly filled with text. To accomplish a layout, the text is structured in 'elements' like Paragraphs, Headers, Lists, Tables, etc. These elements are indicated by HTML-tags.
Nearly all elements may have the attributes:
| { See section Links (and Styles) below } |
| |
| { Language } |
| { text direction } |
| { See section Style below } |
| { Pop-up text } |
| {deprecated; use style } |
|
<P>Paragraph [</P>] with leading whitespace (about one line).
<BR>with line break.
Example of <B>bold</B>, <I>italic</I>, <U>underlined</U> and <S>strike-out</S> text
(Underline and Strike-out are deprecated; use text styles).
Example of <SUB>subscript</SUB> and <SUP>superscript</SUP> text.
Example of <DEL>deleted<DEL> and
<INS>inserted</INS> text.
<ACRONYM title="World Wide Web">(hover mouse over): WWW</ACRONYM>
<ABBR> is similar, but doesn't seem to work in Iexplorer.
The same effect can be achieved through <SPAN title="Pop-up through Span/title">(hover mouse over)</span>.
For special symbols ('glyphs') in HTML see the HTML Characters page.
<H3>Headers</H3>
Headers are a special form of paragraphs, rendering the text larger and usually in bold. The header element contains a level-number, where 1 is the most important header (e.g. corresponding to chapter title) and 6 is the least important (e.g. corresponding to a subsubsection). The headers are not presented with a section number.
Lists
<UL {type="list-style-type: disc | circle | square"}>Unordered (bulleted) lists
</UL>
<OL {style=list-style-type: decimal | lower-alpha | upper-alpha | lower-roman | upper-roman | none"}>Ordered (numbered) lists
</OL>
Note that there are more options via Styles.
<DL>Definition Lists
</DL>
Lists can -of course- be nested.
| <TABLE | ||
| align = left | center | right | deprecated (position of table) | |
| width = «size» | ||
| [ frame = void | above | below | hsides | vsides| lhs | rhs | box | border ] | { table outside border } | |
| [ rules = none | groups | rows | cols | all ] | { cell border } | |
| [ border = «pixels» ] | { thickness in pixels } | |
| [ cellspacing = «pixels» ] | { between cell borders } | |
| [ cellpadding = «pixels» ] | { between cell border and text } | |
| > | ||
| [ <CAPTION [align= top | bottom | left | right ] > text </CAPTION> ] | { table caption } | |
| [ «COLGROUP_definition» ] | ||
| …«table rows»… | ||
| </TABLE> | ||
| <COLGROUP [span=n] [width=«size»] [«halign»] [«valign»] > [«COL_definition»]* [</COLGROUP>] | |||
| «COL_definition» | <COL [span=n] [width=«size»] [«halign»] [«valign»] > | { attributes for corresponding column } | |
| «halign» | align= left | center | right | justify | char | ||
| char="char" | { alignment character, e.g. "." } | ||
| charoff=«size» | { character offset } | ||
| «valign» | valign= top | middle | bottom | baseline | ||
| {COLGROUP is not implemented by FireFox !} | |||
Table row: <TR> …cells… [</TR>]
Cell: <TD> «cell content» [</TD>]
or <TH> «cell content» [</TH>] for 'header cells' causing text to be bolded and centered.
There are also tags for header and footer rows (THEAD, TFOOT, TBODY) to allow scrolling of the tabel body independent of the header and footer, but these do not work (at least not in Iexplorer v6).
Forms are basically used to enter data to submit them to the server, but can also be used for input to a script (e.g. JavaScript).
| <FORM> | ||
| action = URI | { the URL of the processing agent; required attribute, but URL can be empty "" } | |
| method = get | post | ||
| enctype = content-type (default "application/x-www-form-urlencoded") | ||
| accept-charset = charset_list (default "UNKNOWN") | ||
| accept = | { content-type-list e.g. "text/html", "image/png", "text/css", … } | |
| name = «name» | { forms name for reference; preferably use Id } | |
| «input_elements» and/or «select-elements» and/or «button-elements» and/or other HTML elements and text | ||
| </FORM> | ||
| <INPUT | ||
| type = text | password | { normal text or '*' echo } | |
| = | checkbox | radio | { on/of-switches or choice } | |
| = | button | | { general button, use 'value' to assign label } | |
| = | submit | reset | { submit date or clear } | |
| = | image | { grahical submit button } | |
| = | file | { allows files to be selected for submission } | |
| = | hidden | { non-displayed value, e.g. for identification } | |
| name = field name | { for reference, also used to group radio & checkbox buttons } | |
| value = initial value | { optional except for "radio" or "checkbox", then it can be "checked" } | |
| checked | { when the type is "radio" or "checkbox", it specifies that the button is on } | |
| size = «width» | { pixels, or when type is "text" or "password", number of characters } | |
| maxlength = #chars | { when type is "text", the maximum number of characters the user may enter. It may exceed the specified 'size', so the user agent should offer a scrolling mechanism. Default is unlimited } | |
| readonly | { user may not modify text } | |
| accept = Mime | { list of MIME types for file upload } | |
| src = uri | { when the type is "image", the URL to decorate the button } | |
| alt = text | { alternate description for image } | |
| usemap | { use client-side image map } | |
| ismap | { use server-side image map } | |
| tabindex = «number» | { position in tabbing order } | |
| accesskey = «char» | { focus to the element by Alt/«char» } | |
| > | { No closing tag } | |
| <BUTTON | { General pushbutton element } | |
| name = «name» | { control name } | |
| value = | { initial value, sent to server when submitted } | |
| type= button | submit | reset | { for use as form button; default 'submit' } | |
| tabindex = «number» | { position in tabbing order } | |
| accesskey = «char» | { focus to the element by Alt/«char» } | |
| button text | ||
| </BUTTON> | ||
| <SELECT | ||
| name = «name» | { field name } | |
| size = #lines | { rows visible } | |
| multiple | { allow multiple selections (shift/click); default is single selection } | |
| tabindex = «number» | { position in tabbing order } | |
| > | ||
| <OPTION | { multiple Option-elements, each defining a single choice } | |
| selected | { if Select has the Multiple-option set, multiple Options can be preselected } | |
| value = text | { default: option description text } | |
| label = text | { internal alternative for 'value' } | |
| > | ||
| option description text | { what the user sees } | |
| </OPTION> | { optional } | |
| </SELECT> | ||
| <TEXTAREA | { Multi-line text (input) area } | |
| name = «name» | { name for reference; preferably use Id } | |
| rows = «number» | { height in lines } | |
| cols = «number» | { width in characters } | |
| readonly | { user may not modify text } | |
| tabindex = «number» | { position in tabbing order } | |
| accesskey = «char» | { focus to the element by Alt/«char» } | |
| > | ||
| First line of initial text … | ||
| </TEXTAREA> | ||
Links (hypertext references, source anchor):
| <A href="URI" | { for URI see below } | |
| [ type='«target_content_type»' ] | { Mime type of target (not required when .html) } | |
| [ title="Simple link to top" ] | { Pop-up text } | |
| [ target=frame_name ] | { Required when target text is to appear in another frame (see below) } | |
| >top</A> | { Hypertext } | |
URI (= URL) comes in 2 forms: absolute and relative references.
| Absolute: | "http://www.site.type/dir…dir/file.html [ #«location_name» ] " | ||
| Relative: | a relative path starting from the current page | ||
| e.g.: ". . /dir2/file2.html" | { first 1 directory up, down dir2, get file2 } | ||
| e.g.: "#section2" | { go to the section2 anchor in current page } | ||
Anchor:
Destination anchor: <A name=«location_name»></A>
{use of the id-attribute in the element (e.g. <P id=«location_name»>) is not always supported}
The anchor "top" is usually predefined at top of page.
Predefined frame names:
| _blank | load the designated document in a new, unnamed window (force new window) | |
| _self | load the document in the same frame as the element that refers to this target | |
| _parent | load the document into the immediate FRAMESET parent of the current frame. This value is equivalent to _self if the current frame has no parent. | |
| _top | load the document into the full, original window (thus canceling all other frames). This value is equivalent to _self if the current frame has no parent. |
'Styles' allow a more sophisticated rendering of text. Styles can be defined at 3 locations:
| REL attribute | TITLE attribute | |
| Persistent: | "stylesheet" | - (not set) |
| Preferred: | "stylesheet" | some name |
| Alternate: | "alternate stylesheet" | alternate name |
Examples:
| <HEAD> … <STYLE TYPE="text/css"> | |||
| BODY | { background-color: silver } | /* page background light grey*/ | |
| H1 | { text-align: center; font-variant: small-caps } | /* for all H1-tags */ | |
| P.note | { text-align: center; border-style: solid } | /* P subclass for notes */ | |
| .smlcps | { font-variant: small-caps } | /* general class for small-caps */ | |
| TD#z9 | { font-weight: bold } | /* id for bold cells */ | |
| #blue | { font-color: blue } | /* general id for (dark) blue text*/ | |
| </STYLE> … </HEAD><BODY> … | |||
| <H1>Chapter 1</H1> | always centered | ||
| <P class=note>Please note<BR>… | will be centered, with border | ||
| <TD id=z9> | cell with bolded text | ||
| <H3 class=smlcps> | header 3 with small-caps text | ||
| <LI id=blue> | list item in blue | ||
HTML has 2 tags specifically suited to apply styles:
The style attributes are:
| margin-top (transparent) | ||||||||||
| border (border color) | ||||||||||
| padding-top (bgcolor) | ||||||||||
| margin- left | border- left | padding- left | object | padding- right | border right | margin- right | ||||
| padding-bottom | ||||||||||
| border-bottom | ||||||||||
| margin-bottom | ||||||||||
Some style attributes for special objects (e.g. Body, Frame):
| : dark grey; | /* scroll bar and arrow boxes */ |
| : light grey; | /* gutter of a scroll bar */ |
| : dark grey; | /* arrows */ |
There are also pseudo classes. The following is an example of the Anchor pseudo-class
| { color: red } | /* unvisited link */ |
| { color: blue } | /* visited links */ |
| { color: lime } | /* active links */ |
It is also possible to change atributes of an entity at some even, e.g. when the pointer is hovering above it (at least in IExplorer >v4). Example:
| { text-decoration:underline; } |
| which requires that the attributes are reset when out of focus: | |
| { text-decoration:none } |
=O=