![]() |
|
XHTML Tag and Attribute Rules, Learn XHTML online for free, Free online Extensible HyperText Markup Language Tutorial... |
| Lessons | XHTML Tag and Attribute Rules |
|
||||||||
|
<BODY> <P>This is a paragraph</P> <STRONG>This text is bold. </STRONG> <FONT COLOR="red"> This text is red. </FONT> </BODY> The above is valid HTML, but the same is not valid XHTML. XHTML case rule requires us to use lower case in HTML elements and its attributes. Note that we used all uppercase in the elements and attributes above. The correct XHTML version of the above HTML code is as under: <body> <p>This is a paragraph</p> <strong>This text is bold. </strong> <font color="red"> This text is red. </font> </body> XHTML attribute rule also requires us to properly quote the attribute values. Consider the following example: <font color=red> <font color="red> <font color=red"> <font color='red"> <font color="red'> <font color='red> <font color=red'> All of the above examples are not valid XHTML. The correct code is as under: <font color='red'> <font color="red"> Note that the attribute values can be quoted either with a single quote ' or with the double quotes ". Mixed use of quotes e.g. ' " or " ' is not allowed.
Next >>> Lesson No. 6: XHTML DOCTYPE declaration
|