Question:
difference between html and xhtml?
2009-05-17 19:11:29 UTC
Am right in saying the the only 2 difference between these 2 are,

1) All xhtml tags must be closed either using or if they are stand alone tags then />
2) xhtml give some new attributes to some tags (hmm i don't know if this is true)

3) Does xhtml have any new tags from html?
Four answers:
Din
2009-05-17 19:26:04 UTC
XML is a more versatile markup language than HTML, allowing complete customization of tags and attributes. XHTML is basically HTML redefined to meet XML requirements, including a new document type definition and namespace declaration, requiring closing tags for all opening tags (or self-closing tags like < br />,
, etc.), and all attributes contained in double-quotes.



Big differences between HTML and XHTML are the deprecation (dropping support) for certain HTML formatting tags, like , , , , and a few others in favor of more generic style attributes that allow custom style-sheets and generally keep formatting information separate from web page content. Transitional XHTML offers looser requirements than Strict XHTML, so the doctype and namespace declarations need to match what ends up in the page source.
ruanchored
2009-05-17 19:39:41 UTC
Jack's got a good answer, but he didn't explain much the reasoning behind it. It greatly impoves the modularity of the code, helps with DOM-related programming, and helps improve compatibility among browsers. Lots of HTML pages aren't interpretted the same between different browsers. They're likely to render the page in quirks mode rather than in standards mode. I use XHTML 1.1 Strict for most things. I'm not saying well-written HTML code with a DOCTYPE tag can't be interpretted in standards mode, just that I've had better success with XHTML 1.1



w3schools.com is a very helpful site, but pretty basic stuff without much detail. The full specs are on w3.org, eg http://www.w3.org/TR/xhtml11/

They also have validators for their various specs at http://validator.w3.org .



But one of the most useful references I've found for XHTML is at http://learningforlife.fsu.edu/webmaster/references/xhtml/tags/ . It really helps for understanding the modularity of the system.



Complying with every last little demand of the spec is sometimes annoying, but in general I find it helps me write cleaner code that's easier to parse and pinpoint any problems. Strictness is good.
Bernadette
2016-04-02 03:38:11 UTC
XHTML is an extension of HTML, XHTML is based on XML, XML is a tag metalanguage which is a language meant to create other languages. XHTML has a very strict structure and spelling based on the XML rules. HTML doesn't have a very strict grammar and doesn't follow all the XML rules. XML was designed as a simplification of SGML to manage information on the Internet and are both based on tags, utilised to classify and give structure to the information on a text document.
Jack
2009-05-17 19:19:57 UTC
XHTML is a sort of merge of XML and HTML -- basically HTML with XML-like syntax. See: http://www.w3schools.com/Xhtml/xhtml_html.asp


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...