The lang attribute allows we to indicate the main language used in a document, but this attribute was kept in HTML only for backwards compatibility with earlier versions of HTML. This attribute has been replaced by the xml:lang attribute in new XHTML documents.
When included within the <html> tag, the lang attribute specifies the language we've generally used within the document. When we used within other tags, the lang attribute specifies the language we used within that tag's content. Ideally, the browser will use lang to better render the text for the user.
The values of the lang attribute are ISO-639 standard two-character language codes. Check HTML Language Codes: ISO 639 for a complete list of language codes.
Sample:
The xml:lang Attribute:<html lang=fr><head><title>French Language Page</title></head><body>This page is using French Language</body></html>
The xml:lang attribute is the XHTML replacement for the lang attribute. The value of the xml:lang attribute should be an ISO-639 country code as mentioned in previous section.
Generic Attributes:
Here's a table of some other attributes that are readily usable with many of HTML's tags.
| Attribute | Options | Function |
|---|---|---|
| align | right, left, center | Horizontally aligns tags |
| valign | top, middle, bottom | Vertically aligns tags within an HTML element. |
| bgcolor | numeric, hexidecimal, RGB values | Places a background color behind an element |
| background | URL | Places an background image behind an element |
| id | User Defined | Names an element for use with Cascading Style Sheets. |
| class | User Defined | Classifies an element for use with Cascading Style Sheets. |
| width | Numeric Value | Specifies the width of tables, images, or table cells. |
| height | Numeric Value | Specifies the height of tables, images, or table cells. |
| title | User Defined | "Pop-up" title for your elements. |
For a complete list of HTML Tags and related attributes please check reference to HTML Tags List.

No comments:
Post a Comment