Desi Forums - View Single Post - XHTML Tutorial
Thread: XHTML Tutorial
View Single Post
  #6 (permalink)  
Old 08-01-2007, 09:56 AM
mytonse's Avatar
mytonse mytonse is offline
Exorbitant
Location: India
Gender:
Visit mytonse's Blog
 
Join Date: Dec 2005
Age: 19
Posts: 3,368
Credits: 36,535
mytonse is a glorious beacon of lightmytonse is a glorious beacon of lightmytonse is a glorious beacon of lightmytonse is a glorious beacon of lightmytonse is a glorious beacon of light
Send a message via MSN to mytonse Send a message via Yahoo to mytonse Send a message via Skype™ to mytonse
Class 2-"The Syntax of HTML"

Hello folks,

Hope you are all doing well.Since the syntax is a bit lengthy i broke the topic into two for comfortable and pleasant study.

Continuing-

XHTML when written demands a cleaner HTML syntax.

So a cleaner HTML syntax forms the first rule . A few other XHML syntax rules are as follows-

a.Attribute names must be in lower case

b.Attribute values must be quoted

c.Attribute minimization is forbidden

d.The id attribute replaces the name attribute

e.The XHTML DTD defines mandatory elements

---------------------------------------------------------------------------------------------------

Lets do a casestudy of the above syntax rules.Take the first rule down

a.Attribute Names Must Be In Lower Case

This is wrong:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

This is correct:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

--------------------------------------------------------------------------------

b.Attribute Values Must Be Quoted

This is wrong:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

This is correct:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

--------------------------------------------------------------------------------

c.Attribute Minimization Is Forbidden

This is wrong:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

This is correct:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

Here is a list of the minimized attributes in HTML and how they should be written in XHTML:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

--------------------------------------------------------------------------------

The id Attribute Replaces The name Attribute

HTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, img, and map. In XHTML the name attribute is deprecated. Use id instead.

This is wrong:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

This is correct:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

IMPORTANT Compatibility Note:
To make your XHTML compatible with today's browsers, you should add an extra space before the "/" symbol.

--------------------------------------------------------------------------------

The Lang Attribute

The lang attribute applies to almost every XHTML element. It specifies the language of the content within an element.
If you use the lang attribute in an element, you must add the xml:lang attribute, like this:

[Only Registered and Activated Users Can See Links. Click Here To Register...]
--------------------------------------------------------------------------------

Mandatory XHTML Elements

All XHTML documents must have a DOCTYPE declaration. The html, head and body elements must be present, and the title must be present inside the head element.
This is a minimum XHTML document template:
[Only Registered and Activated Users Can See Links. Click Here To Register...]

Note: The DOCTYPE declaration is not a part of the XHTML document itself. It is not an XHTML element, and it should not have a closing tag.

More Later.Class Dismissed.

Last edited by mytonse; 08-01-2007 at 10:17 AM.
Reply With Quote