Does anyone know if I can head directly for XHTML without learning HTML?
Is there a difference?

Recommended Answers

All 6 Replies

I think there is a lot difference between XHTML and HTML

There is quite a few differences in the markup of XHTML compared to HTML, but most are simple to get used to, ie you need to use lowercase letters in XHTML and use closing tags properly.

eg:
<BODY>
<P>your text here</P>
</BODY> (This is incorrect xhtml)

<body>
<p>your text here</p>
</body> (this is correct)

If it is a case of learning one of them correctly I would suggest XHTML, probably starting with XHTML 1.0 Transitional as XHTML is now the W3C compliant standard. The advantages of XHTML 1.0 Transitional is that it allows a lot of things like iframes and opening links in new windows that the Strict version will not. Unless you really want to give yourself a headache I would stay away from XHTML 1.1

They are pretty much the same except that XHTML is more strict and must be lower case. Also you have to end and open tags, where you want them to end. I recommend XHTML as it's just good practice to make your code like that.

If you’ve mastered HTML, you’re 90% of the way towards using XHTML. They’re actually very much the same thing—tag-based markup languages used to display Web pages. The difference is only seen by the people creating the pages (Web designers, programmers, etc.) and focuses on “forgivability”— HTML allows for some ugly code (mixed-case tags like <BoDy>, improperly nested elements, and unclosed tags), while XHTML does not. If you write HTML, it’s probably a good idea to start using XHTML practices anyway.

In XHTML, all tags must be lowercase.
In XHTML, all tags must be closed.
In XHTML, tags must be properly nested.

the above are not in html...

And,

* XHTML must be served with an XML MIME type, such as application/xml or application/xhtml+xml.
* HTML must be served as text/html.

It is the MIME type that determines what type of document you are using. If you use attempt to send XHTML as text/html, you are actually just using HTML, possibly with syntax errors.

Technically, according to the spec, XHTML 1.0 is allowed to be served as text/html. But, due to the above reason, such a document is considered to be an HTML document, not an XHTML document.

see it for reference:
http://wiki.whatwg.org/wiki/HTML_vs._XHTML

HTML is rapidly being replaced by XHTML. The differences are very minor, but the results of switching can be worth the effort. The primary benefit is that XHTML is more widely accepted in non "computer" devices like cell phone, palm devices and other scaled down browsers. This is commonly called portability between devices.
XHTML is also said to be extensible, which is the fancy way of saying the new tags can be added without a new document type declaration.

there are difference but i think a newbie does not got any difference.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.