Write a valid XHTML document – 5 important steps
XHTML is a xml based language which is the main difference from normal HTML. There are several rules to make a document a valid xhtml but here i will show you 5 most important steps to follow.
Proper nesting of elements:
Proper nesting of elements is applicable for both HTML as well as XHTML. In XHTML, this rule will be strictly followed.
Every elements should be closed:
It is important to close all elements including empty elements. An empty element can be terminated by using a slash (for example <br />). Adding a space before the slash is an intelligent way to avoid syntax error problems in some browsers.
Representing element and attribute names in lowercase:
All elements and attribute names should be written in lowercase which is not necessary in HTML.
Enclosing scripts with CDATA:
It is advisable to enclose the scripts with CDATA(Character data).
CDATA is a data type and by applying, the scripts inside this section will be treated as simple text characters. Below is a example format shown
<script type="type/javascript">
// <![CDATA[
Actual script here...
// ]]>
</script>
Putting attribute values inside quotation marks:
All attribute values must be enclosed with single or double quotation marks.
In order to check whether your pages are a valid xhtml, you can use free online validating services like W3C.




(average: 4.00 out of 5)


Write your comment