In the previous discussion, we have noticed about Basic Learning Web Based Technology and Guidelines and Concept of HTML Tags and Elements. In this discussion, we will be guided step by step to understand about several flavors of both HTML and XHTML that have been specified over the years. As the benefits of a standards-compliant Internet began to be more widely accepted and the transition from HTML to XML-based XHTML began, two types of XHTML were created.

One of them is called XHTML 1.0 Transitional, and the other is XHTML 1.0 Strict. As the name implies, the transitional document type was meant to be more flexible and forgiving than it’s strict counterpart and was intended to be an intermediate step for developers who were used to the looser grammar and syntax of HTML. Because this transition should in most cases be over already and, more important, because you most likely do not fit into the aforementioned category of developers, you will simply jump in to learning XHTML 1.0 Strict.

One of the most common questions for those starting out is “should I be using HTML or XHTML, and what the heck is the difference?” HTML document, element and attributes are used case insensitive, if we use “<p>”  same things as “<P>”. In XHTML, elements and attributes are case sensitibe and commonly they are all lowercase. Others different HMTL and XHTML is certain elements don’t need a closing tag while others forbid the closing tag. In XHTML, all elements must be explicitly closed, if elements without content may be closed using a slash in the start tag, such “<hr></hr>” and “<hr />” mean the same thing. Some attribute values in HTML may be written without being enclose in quotes while in XHTML attributes values must be enclosed by quotes. It’s the biggest difference of HTML and XHTML documents, for detail see W3C website.

In the above explanation, we have to know the biggest difference between HTML and XHTML. So, now that we know that we need to insert a doctype and what is used for, how will we know which one to choose ?

If our document is HTML, we can use this :

1
2
3
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
         "http://www.w3.org/TR/html4/DTD/strict.dtd">

If our document is XHTML, we use this :

1
2
3
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Both of these doctypes will ensure that browsers use their Standards mode when dealing with your document. The most noticeable effect that will have on your work is that you will get more consistent results when styling the document with CSS. To see some of the other doctypes that you could use, the W3C have published a list of Recommended DTDs to use in your Web document.

We hope this discussion, we have the additional knowledge about what and how to insert HTML Document Type. See detail about HTML and web developer in others discussion at this site.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • Slashdot
  • Technorati
  • YahooMyWeb