Saturday, November 9, 2019
The Impact of the Printing Press on Education
Interactive Media Center http://library. albany. edu/imc/ HTML & XHTML Tag Quick Reference This reference notes some of the most commonly used HTML and XHTML tags. It is not, nor is it intended to be, a comprehensive list of available tags. Details regarding the proper use of XHTML are at the end of this document. What It Is Basic Document Tags What It Does Indicates the start and end of an HTML Document Defines the portion of the document that contains essential formatting information. The material in the head is invisible. Defines the portion of the document that contains the visible information. Body Attributes What It Is What It Does Specifies the background color Specifies the text color Specifies the color of unfollowed links. Specifies the color of followed links. Specifies the color of links when they are clicked. NOTE: Body attributes may be combined within the body tag. Example: Text Tags What It Does The heading tags display text in sizes ranging from the ,, largest, h1, to the smallest, h6. These specifications ,, are intended to denote the importance data below the , heading. Specifies bold text. Specifies italics text. Specifies a typewriter or teletype-like text. Creates an emphasis on text that is rendered usually as italics, but sometimes as bold depending on the browser. Creates an emphasis on text that is usually rendered as bold, but sometimes as italics depending on the browser. Specifies the font size from 1 to 7. 1 is the largest, 7 the smallest, and 3 is generally the default size. Specifies font color. NOTE: Font attributes may be combined within the font tag. Example: Example of combined font attributes. 9/03 R. Lipera v. 2. 2 What It Is Interactive Media Center http://library. albany. edu/imc/ Common Formatting Tags What It Is (HTML) What It Is What It Does (XHTML) Defines a paragraph. Defines paragraph alignment left, right, or center. Inserts a line break. Defines a block quote and indents text from both sides. Usually with some extra space above and below. Defines the beginning and end of an ordered list. Defines the beginning and end of an unordered list. Defines the beginning and end of a line within a list. Start a line with a number in an ordered list, and with a bullet in an unordered list. Image Tags What It Is (HTML) What It Is (XHTML) What It Does Places and image. Specifies the alignment of an image; middle Specifies a border around and Specifies the alternative label for an for use nongraphical browsers. NOTE: Attributes within the font tag may be combined. Example in HTML: Example in XHTML: What It Is (HTML) Horizontal Rule Tags What It Is What It Does (XHTML) Specifies the start of a horizontal rule. Specifies the height of a horizontal rule. Specifies the width of a horizontal 9/03 R. Lipera v. 2. 2 2 Interactive Media Center http://library. lbany. edu/imc/ rule in either pixels or percent. States that the horizontal rule should have no shade. NOTE: Attributes within the horizontal rule tag may be combined. Example in HTML: Example in XHTML: Table Tags What It Is What It Does Specifies the beginning and end of a table. Specifies the beginning and end of a table row. Specifies the beginning and end of a table cell. Defines a table header. A normal cell with text that is bold and centered. Specifies the size of the border around a table and cells within the table. Specifies the space between cells. Specifies the amount of space between the border of a cell and the items within the cell. Specifies the width of a table in either pixels or percent. Specifies the alignment of contents in a row of cells as either left, right, or center. Specifies the alignment of contents in a cell as either left, right, or center. Specifies the vertical alignment of contents in a row of cells as either top, bottom, or middle. Specifies the vertical alignment of contents in cell as either top, bottom, or middle. Specifies the number of columns a cell will span. Specifies the number of rows a cell will span. Stops text from automatically line wrapping. 9/03 R. Lipera v. 2. 2 3 Interactive Media Center http://library. albany. edu/imc/ XHTML can be thought of as an upgraded and stricter version of HTML 4. 01. It is not much more difficult to write XHTML than it is to write properly formed HTML. There are some simple rules that must be followed. The most important rules are: â⬠¢ â⬠¢ â⬠¢ â⬠¢ XHTML tags must all be in lower case. XHTML elements must be nested correctly. All XHTML tag elements must be closed. Documents written in XHTML must be well-formed. Examples of lower case rule: This is incorrect. This is correct. Examples of the nesting rule: This is incorrect nesting. This is correct nesting. Examples of the closed tag rule: This horizontal rule tag is not closed- This horizontal rule tag is closed- This image tag is not closed- This image tag is properly closed- Examples of the well-formed document rule: XHTML documents must have the proper structure. This means all components must be within the opening and closing HTML tags, . Internal elements must be correctly nested and located properly. The basic components and structure of an XHTML document are 9/03 R. Lipera v. 2. 2 4 Interactive Media Center http://library. albany. edu/imc/ XHTML Syntax Rules XHTML requires that some basic rules of syntax be followed. As with the tag rules noted above, XHTML syntax is not much more difficult that correctly formed HTML. These rules are, however, much stricter and must not be violated. These rules follow. â⬠¢ â⬠¢ â⬠¢ â⬠¢ Attributes must be quoted. The Name attribute is replaced by the ID attribute Attribute shorthand must not be used. DOCTYPE statement must be used. The DOCTYPE statement is part of Document Type Definition, DTD, and is used to specify which syntax is used in the Web page. ) Examples of the quoted attribute rule: This is incorrect- This is correct- Examples of the Name attribute replacement rule: This is incorrect- This is the correct substitution- Examples of the no shorthand rule: This is an example of improper shorthand- This is the same tag corre ctly written without shorthand- Examples of DOCTYPE statements: This is a page without a statement 9/03 R. Lipera v. 2. 2 5 Interactive Media Center http://library. albany. edu/imc/ Example of a page with a DOCTYPE statement Note that the DOCTYPE statement goes ahead of the opening HTML tag, . The statement is not part of the HTML document and does not have a closing tag. It is used to tell a browser how to render the document. There are three DOCTYPE statements. Statement used to create clutter-free presentations and when Cascading Style Sheets are used: Statement used when HTML presentational features are present and when it is desirable to support older browsers that do not understand Style Sheets: Statement used when frames are incorporated into the design of the page: 9/03 R. Lipera v. 2. 2 6
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.