If you like SEOmastering Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

XHTML vs HTML ?

Started by welshboy, 05-19-2010, 18:08:25

Previous topic - Next topic

welshboyTopic starter

Hey guys,

Simple question for you tag geniuses, what's the real difference between XHTML and HTML (apart from the X of course). I need to get this right so anyone with links or info explaining this would be awesome!
  •  


Sevam

The Most Important Differences:

    * XHTML elements must be properly nested
    * XHTML elements must always be closed
    * XHTML elements must be in lowercase
    * XHTML dоcuments must have one root element
    * XHTML is XML, which means that the syntax rules are slightly different.
    * There are things you can do in XHTML which you cannot do in HTML.
    * There are things you can do in HTML which you cannot do in XHTML.
    * There are differences concerning CSS.
    * There are differences concerning client-side scripting (e.g., JavaScript).

Differences in Syntax Rules

    * XHTML is case-sensitive, HTML is not. All tags and attributes must be lowercase in XHTML.
    * XHTML, being XML, must be well-formed. Every element must have an end tag, or use the self-closing tag syntax. HTML allows some end tags and even some start tags to be omitted.
    * If an XML parser encounters a well-formedness error, it must abort. An SGML or HTML parser is expected to try to salvage what it can and keep going.
    * All attributes must have a value in XHTML. HTML allows some attributes (e.g., selected) to be minimised.
    * All attribute values must be surrounded by double or single quotes. HTML allows quotes to be omitted if the value contains only alphanumeric characters (and some others).
    * The comment syntax is more limited in XHTML, but that's rarely an issue for most designers/developers.


Things You Can Do in XHTML But Not In HTML

    * Use CDATA sections (<![CDATA[ ... ]]>). That's useful if you have content with lots of literal characters that otherwise need to be escaped.
    * Use PIs (processing instructions), e.g., to link to a style sheet:
      <?xml-stylesheet type="text/css" href="style.css" media="screen"?>
    * Include elements from other XML namespaces (see below).
    * Use the &apos; character entity.


Things You Can Do in HTML But Cannot Do in XHTML

    * 'Hide' the contents of style or script elements with SGML comments (<!--...-->).
    * Create parts of the page dynamically with JavaScript while the dоcument is still loading (e.g., using dоcument.write()).
    * Use named character entities (e.g., &nbsp;) other than the four predefined ones: &lt;, &gt;, &amp; and &quot;.
    * Use the .innerHTML property with JavaScript (technically this is non-standard even in HTML).


Differences Concerning CSS

    * Element type selectors in CSS are case sensitive for XHTML, but not for HTML.
    * In HTML, the properties background-color, background-image and overflow on the BODY element will be applied to the root element (HTML) unless specified for that element also. That is not the case for XHTML.


pstpl1

Even though this is a CSS reference, we should spend some time talking about HTML and XHTML, because your choice of markup language will affect how CSS is applied in some instances. Moreover, in order to understand the variations in the way CSS is applied to HTML and XHTML, you need to grasp the fundamental differences between the two markup languages.
ERP Software [nofollow]
Payroll Software [nofollow]
  •  


MarcoLeitner

HTML:
1.Html is a markup language for creating webpages and information can be displayed in a web browser.
2.The Extension of html file is .html, .htm
3.Its internet media type is text/html.
4.Proposed by Tim Berner Lee in 1987.
5. Type of format is dоcument file format

XHTML:
1.XHTML is a extensible hyper text markup language and is a family of XML markup language.
2.The extension of Xhtml file is  .xhtml,.xht,.xml
3.Its internet media type is text/xhtml+xml
4.Proposed by world wide web consortium recommendation in 2000.
5.Type of format is markup language.

SanviMalhotra

1. HTML or HyperText Markup Language is the main markup language for creating web pages where as XHTML  is a family of XML markup languages that mirror or extend versions of the widely used Hypertext Markup Language.

2. HTML is developed by W3C & WHATWG and XHTML is developed by World Wide Web Consortium.

Shikha Singh

HTML and XHTML are both languages in which web pages are written. HTML is SGML-based while XHTML is XML-based. They are like two sides of the same coin. XHTML was derived from HTML to conform to XML standards. Hence XHTML is strict when compared to HTML and does not allow user to get away with lapses in coding and structure.


RH-Calvin

Extensible Hypertext Markup Language (XHTML) is part of the family of XML markup languages. It mirrors or extends versions of the widely used Hypertext Markup Language (HTML), the language in which Web pages are formulated.


michral86

HTML and XHTML are both languages in which web pages are written. HTML is SGML-based while XHTML is XML-based.
XHTML was derived from HTML to conform to XML standards. Hence XHTML is strict when compared to HTML and does not allow user to get away with lapses in coding and structure.

The reason for XHTML to be developed was convoluted browser specific tags.
Pages coded in HTML appeared different in different browsers.

example, while <br> is valid in HTML, it would be required to write <br/> in XHTML.


If you like SEOmastering Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...