tumblr hit counter

The lang Attribute

Monday, October 14, 2013

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:
<html lang=fr>
<head>
<title>French Language Page</title>
</head>
<body>
This page is using French Language
</body>
</html>
The xml:lang Attribute:
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.
We will see related examples as we will proceed to study other HTML tags.

For a complete list of HTML Tags and related attributes please check reference to HTML Tags List.



<< Previous Next >>

Page >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14

No comments:

Post a Comment

 

Click Here to Start Learning

Get Update!

Join Us Now !
Enter your email address:

Note: Don't forget to click the confirmation link (in your email) to verify Your Entry!

LEARN WEB DESIGN