Author Topic: XHTML vs HTML ?  (Read 4082 times)

Offline welshboyTopic starter

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 0
  • Posts: 33
  • Karma: 1
« on: 05-19-2010, 17:08:25 »
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!

Offline Sevam

  • Administrator
  • Trade Count: (0)
  • *****
  • Thank You 73
  • Posts: 358
  • Karma: 11
  • Gender: Male
    • Trust Directory Project
« Reply #1 on: 05-30-2010, 01:07:00 »
The Most Important Differences:

    * XHTML elements must be properly nested
    * XHTML elements must always be closed
    * XHTML elements must be in lowercase
    * XHTML documents 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 document is still loading (e.g., using document.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.

Offline pstpl1

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 0
  • Posts: 14
  • Karma: 0
  • Gender: Female
  • ERP Software
    • ERP
« Reply #2 on: 01-17-2013, 03:25:28 »
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]

Offline MarcoLeitner

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 2
  • Posts: 33
  • Karma: 0
  • Gender: Male
    • http://www.techiring.com
« Reply #3 on: 06-04-2015, 23:51:40 »
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 document file format

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.

Offline SanviMalhotra

  • Trade Count: (0)
  • Jr. Member
  • **
  • Thank You 0
  • Posts: 57
  • Karma: 0
  • Gender: Female
    • Best E-commerce Platform in India
« Reply #4 on: 08-19-2015, 01:21:23 »
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.

Offline Shikha Singh

  • Trade Count: (0)
  • Sr. Member
  • ****
  • Thank You 41
  • Posts: 335
  • Karma: 0
  • Gender: Female
  • solution to start online business
    • solution to start online business
« Reply #5 on: 02-18-2016, 05:11:10 »
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.

Offline RH-Calvin

  • Trade Count: (0)
  • Hero Member
  • *****
  • Thank You 53
  • Posts: 1093
  • Karma: -1
  • Gender: Male
    • Cheap VPS Hosting
« Reply #6 on: 02-18-2016, 23:30:49 »
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.


Related Topics

  Subject / Started by Replies Last post
10 Replies
Last post 02-24-2016, 01:06:16
by Shikha Singh
4 Replies
Last post 02-12-2016, 01:39:25
by Shikha Singh
0 Replies
Last post 11-01-2011, 02:45:00
by Walalayo
0 Replies
Last post 12-26-2011, 02:46:54
by phterthg
0 Replies
Last post 06-29-2014, 23:21:45
by rozepeter15