HTML Vs. XHTML

Abstract: This paper discusses about the differences between HTML and XHTML. The selection of markup language will have impact on how CSS is functional in selected scenarios. And also to understand the distinctions in the method of how CSS is applied to HTML and XHTML, we should learn the basic differences between these two markup languages.

Introduction

HTML and XHTML are both used to write webpages. The utmost significant alteration amongst these two markup languages is that Hyper Text Markup Language also known as HTML, is an application of Standard Generalized Markup Language (SGML), and permits a writer to overlook specific tags and review attribute minimization. The Extensible Hyper Text Markup Language (XHTML) is an application of Extensible Markup Language also referred as XML. Xhtml was resultant of HTML to adapt XML Standards.

Therefore XHTML is stringent when related to HTML and does not allow operator to get away with lapses in coding and structure. The motive for XHTML to be established was complex browser explicit tags. Pages coded in HTML seemed altered in different browsers.

XHTML does not allow the exclusion of any tags or the use of attribute minimization. Though it offers a shorthand code for bare element like we might practice instead of which HTML will not support. A compatible XML manuscript is obligated to be well organized amongst other things, which means that there should be an essential end tag for each and every start tag, and also nested tags should be closed in the correct order. Once XML parser comes across an error involving the document's proper structure, it must terminate, however an HTML parser is probable to try to recuperate and continue.

There are three different regions in which HTML and XHTML differ and can affect use of Style Sheet. They are Optional tags, Case sensitivity, Properties for the root element. Here we have to note that these alterations rub in when an XHTML document is functioned as a presentation of XML. An XHTML document functioned with a MIME type of text or html must be parsed and understood as HTML, hence HTML guidelines are applied in this case. A CSS inscribed for an XHTML document presently served with a MIME type of text or html might not work as planned if the document has earlier helped with a MIME type of application.

This can be exclusively significant whenever you are attending XHTML documents as text or html. Except when you are mindful of the dissimilarities, you possibly could generate CSS that does not work as planned if the document has helped as actual XHTML. Wherever XHTML & XHTML document are seen in the rest of this portion, they denote XHTML markup assisted with an XML MIME type. XHTML markup assisted as text or html is a HTML document as much as browsers are bothered.

MIME Types

When a web document is requested, the web server delivers an HTTP response comprising two parts: the headers and the body. The headers contain Meta information about the body, while the body is the actual document (the HTML or XHTML markup, in this case).One very important HTTP header is called Content-Type. This header specifies the MIME type, and though it can also contain information about the character encoding that's used in the file, this data shouldn't be included for XML documents. The MIME type tells the user agent what type of content it's about to receive.

It's predominantly the MIME type which commands how a web document is controlled by a browser. For an XML MIME type, the tag's xmlns attribute insists on a document having XHTML. The doc type assignment does not matter, but when validating the markup it does.

Internet Explorer (IE) does not support the MIME type application/xhtml+xml. While it allows application/xml and text/xml, it does treat the document as generic XML but not like XHTML. This is one of the reasons why many authors attend their XHTML markup as text/html; however some recognize that this affects browsers to handle their pages as HTML, instead of XHTML. Attending XHTML as text/html is allowed by the W3C, as long as the markup fulfills guidelines in Appendix C of the XHTML 1.0 specification.

Case Sensitivity

Style Sheets are not case sensitive; however, few like document markup language, are away from its control. HTML is not case sensitive in many aspects, but as soon as it approaches certain attribute values, such as id and class attributes. XHTML, because it is XML, is case sensitive always. This indicates that Style Sheet element type selectors meant for an HTML document are not case sensitive, yet they are case sensitive for XHTML.

In attribute selectors designed for HTML documents, attribute names and few attribute values are not case sensitive, whereas additional attribute values mostly id and class are case sensitive. Because these attributes are case sensitive in HTML, ID selectors and class selectors should match the instance of the id and class attribute values in the document all the time. Refer the HTML specification to figure out which attribute values are case sensitive and which are not.

This concern is additionally problematical by the detail that web browser actions are not consistent. Like in IE 6, id and class attributes are only the ones which are case sensitive in standards mode. In Version 3 of Safari and also in earlier versions, attribute selectors are not case sensitive for HTML documents. Meanwhile names and values of all attributes are case sensitive in XHTML, selectors are case sensitive always. The modest way to ease any possible concerns in case sensitivity is usage of lowercase in markup and CSS, wherever possible. If that is not possible in any case assure the case used is steady in between CSS and document markup.

Optional tags

Root Element Properties

For HTML, the CSS2.1 requirement endorses that we require the document background for the body element, rather than for html element. If the calculated value of the background property for the html element is clear i.e. the initial value, any background properties stated for the body element will be practical to the canvas. This is not the case for XHTML.

The Style Sheet 2.1 specification also specifies that an overflow property stated for the body or html elements can be used to the viewport, but then again it is only for HTML documents. In practical even though browsers relate this property to the viewport for XHTML documents also.

HTML Vs. XHTML

XHTML is the latest recommended manner to write web pages. We will discuss the variations in syntax and why there is a need to change. At First, HTML3.2 was there. In the commercial world the difficult web pages saw how easy it is with HTML3.2. Version 3.2 of HTML is known as the not so approved table layout way of doing stuff. But still in most web pages it is still used.

After HTML 3.2, HTML4.0 and HTML4.1 was introduced. HTML4 goes back to stuff that should have been already widespread with HTML3.0. HTML is used for the structure of the content and CSS is used for the presentation of the document. The latest version is XHTML1.0/XHTML1.1. It is dependent on different syntax to some extent. HTML4 is based on SGML whereas XHTML is based on XML. However, some technical reasons are included to make the change. They are:

  • Many Interpreters are there for XML today
  • To convert XML and also XHTML documents XML XPath and XML DOM are the two main powerful mechanisms.
  • XHTML makes working easier for a team(closing tags, case sensitive) as it is a more stream lined.

If we consider the history of HTML it starts with HTML 3.2 which was named at W3C by Wilbur. The later version in few years was HTML 4.0 and HTML 4.01.The HTML 4.01 is the last version of HTML specification to define the semantics of markup languages. The HTML has improved a lot from the HTML 3.2 to HTML 4.01 by the W3C. They have focused on key issues like:

  • Internationalization features have been improved
  • Document rendering has been improved
  • Structure separation from presentation
  • Accessibility features have been improved

XHTML 1.0 was shortly created after the HTML 4.01 to help the transition of the hypertext language to a new generation of the markup languages for text. XHTML 1.1 is the additional step towards the creation of a more flexible version of hypertext with all the benefits of the XML architecture and also the integration of several other different technologies. Note that the XHTML 1.1 has also slightly improved the semantics of the HTML 4.01 by including the Ruby module, which is mainly used in few specific languages like Japanese scripts. For Particular purposes, the discussion always goes on HTML 4.01 and XHTML 1.0.

Semantics meanings

When we refer to the 'semantics' of any language, we are referring to the meaning of a specific tag.Html 4.01 and XHTML 1.0 will assign the same semantics to its elements and their attributes. For example, the address of an element has same meaning in XHTML 1.0 and HTML 4.01: they are both used for the markup addresses. Only the syntax of the bits vary between these two languages. The syntax for both these languages is almost similar and has only a few differences between them. There are three major flavors in these two languages, they are: Strict, Transitional and Frameset.

The "strict" version is strongly recommended by the W3C for all regular documents. Using strict versions we can remove problem creating elements and force the separation between the presentation and structure of any document. Transitional versions will allow the elements to support the implantation and up gradation of the software and its features.

Right tool Use

Switching of the web developer from HTML 4.01 to XHTML 1.0 will never bring any benefits for the website visitors. But still, there are very good reasons to switch from HTML to XHTML in terms of maintenance which becomes easier. XML rules of syntax are rigorous compared to HTML. As a result, XHTML is more precise to work and addresses few issues like:

  • Lower case for all attribute and element names.
  • Quoted attribute values
  • Closing tag for non-empty elements
  • A trailing slash and space are used for ending empty elements
  • Attribute minimization is not allowed
  • Inline elements in strict XHTML should be there in block elements.

In HTML, termination of elements and elements which are uncontained are allowed in commonplace. The errors margin is much broader in HTML compared to XHTML, but the rules are clear. As a result, the maintenance and authorization is easy because the problem syntax can be spotted easily and also the structure is apparent.

XHTML is XSL ready

HTML 4.01 is formulated in XML to create XHTML 1.0. Hence, XHTML documents are XML and hypertext documents. The W3C has developed a powerful technology to transform and manipulate XML documents like XSLT. This Extensible Style Sheet Language Transformations (XSLT) is used to create XHTML documents and new resources for these documents. For example:

  • A long document table contents are created
  • By using XSL-FO features of XSL we can provide printable version for our documents.
  • RSS feed can be produced directly from our web page.

XHTML is easier to teach and to learn

The syntax rules defined by XML are far more consistent than those found in HTML and therefore easier to explain than the SGML rules on which HTML is based.

XHTML is ready for the future

When the new version of XHTML becomes a recommendation, XHTML 1.0 documents can be easily upgradable to this new version taking advantages of its exciting new features. It's likely that an XSLT style sheet will be available by then to help you move your XHTML 1.0 (strict) documents to XHTML 2.0 documents. HTML 4.01 is as valuable as XHTML 1.0 in a daily usage. The syntax proposed by XHTML 1.0 has several important benefits.

For a Web designer, starting to use XHTML 1.0 will be helpful in some circumstances and will certainly help you to smoothly negotiate the future. XHTML 1.0 gives a wonderful opportunity to learn about XML languages and their possibilities without having to learn new semantics because you're working with familiar tags and attributes.

Common Features between HTML and XHTML

Both HTML and XHTML are used for web designing. Each of these languages has many versions which changed ideas. The table below shows the current recommendations of HTML and XHTML:

HTML 4.0 and 4.01: Concepts

Within HTML 4.0 are specific ideas necessary to study if you're to have a full understanding of the versions and languages that have followed. Specifically, HTML 4.0 provides these critical concepts as follows:

  • Deprecation of presentational elements in favor of style sheets. Consider this the heart and soul of contemporary Web design. HTML 4.0 clearly states that the separation of structure and presentation are an imperative goal in order for Web authoring to progress. CSS is the suggested alternative, which in HTML 4.0's emergence in 1997 was more problematic due to browser support than it is today.
  • Awareness of Accessibility and Internationalization. HTML 4.0 is very concerned with ensuring that pages are available to those individuals using alternative user agents, whether due to a disability or simply by virtue of circumstance. Internationalization concerns are brought forth in HTML 4.0, and discussions about how to Internationalize and Globalize HTML and XHTML are ongoing.
  • Improved rendering of Web documents. HTML 4.0 added several elements, specifically in terms of tables, that aid in accelerated interpretation and rendering of markup.
  • Introduction of three unique DTDs. With HTML 4.0 came the concept of three unique public DTDS: Strict, Transitional, and Frameset. The Strict DTD is HTML 4.0 at its most ideal, with the presentation of a document relying on CSS almost entirely. The Transitional DTD allows for the use of deprecated elements, understanding the transitional need for presentation in HTML. Finally, the Frameset DTD formalizes the use of frames in HTML 4.0 and provides a specific set of rules for their implementation.

HTML 4.0 really upped the ante in terms of offering real options and alternatives to Web developers interested in also writing documents that conformed to W3C goals. However, many authors have missed learning these important concepts, which lay the foundation for XHTML. With HTML 4.01, a few errors and editorial changes were introduced. These changes are minor in terms of general concept, but are important because it is upon the updated HTML 4.01 DTDs rather than HTML 4.0 DTDs that XHTML 1.0 is based upon.

XHTML 1.0 and 1.1: Current Ideas and New Directions

XHTML 1.0 is the reformulation of HTML as an XML application. This means that documents as well as syntax must conform strictly to the concepts and DTDs of the language version. The ideas from HTML 4.0, especially the separation of document structure from presentation and issues concerning accessibility and internationalization, are intact in XHTML 1.0. What's more, the three DTD offerings (strict, transitional, and frameset) originally from HTML 4.0 and later refined by HTML 4.01 are essentially the same DTDs found in XHTML 1.0.

XHTML 1.0 is best seen as a transitional language that helps puts professional Web authors in the position of writing specification-oriented markup. It puts browser manufacturers on the hot-seat and tells them "get your acts together!" It also moves us toward the extensible intelligence of XML and away from the limitations of HTML. But transition also means that readying yourself for XML is very important, too. Fortunately, XHTML contains enough of each to help strengthen your HTML skills and to get those of you unfamiliar with XML more comfortable with its applications. Several of the primary XML concepts introduced in XHTML 1.0 are as follows:

  • Reintroducing structure back into the language. Picking up on the SGML and XML idea those documents should be written in conformance with the rules set out within the languages, XHTML insists upon a variety of syntax and semantic rules that must be adhered to. One such rule is the idea of well-formed.
  • Providing authors with incentives to validate documents. The validation of documents is somewhat controversial for a number of reasons. Certain people believe that validation is an unnecessary part of the process so long as the documents are well-formed. However, I personally feel that validation is a powerful learning tool that helps us find our mistakes, fix them, and in the process, understand the way a specific DTD works. Validation, therefore, is encouraged throughout.
  • Accommodating New Devices. Part of the drive to accommodate XML in the Web development environment has to do with an intriguing phenomenon. If the 90s were the years of information explosion and the movement of the PC from the workplace to the home, this decade will be known for the movement away from the desktop.

With XHTML 1.1, the concept of separation of structure and presentation is complete. XHTML 1.1 has only one public DTD, based on the Strict DTD found in XHTML 1.0. Web authors also have the option to work with modularization. Modularization breaks HTML down into discrete modules such as text, images, tables, frames, forms, and so forth. The author can choose which modules he or she wants to use and then write a DTD combining those modules into a unique application. This is the first time we really see the extensibility introduced by XML at work, because instead of having only the public DTDs to choose from, authors can now create their own applications.

Conclusion

In HTML Vs. XHTML you have two equally powerful choices, depending on your needs and work environment you are likely to prefer one over the other. Accessibility and Compatibility of XHTML1 is same as HTML4 .Unless you care about the syntax details, you won't find a reason to switch to it if you feel comfortable with HTML4.0/ HTML4.1.

References:

  1. http://reference.sitepoint.com/css/htmlxhtml

Please be aware that the free essay that you were just reading was not written by us. This essay, and all of the others available to view on the website, were provided to us by students in exchange for services that we offer. This relationship helps our students to get an even better deal while also contributing to the biggest free essay resource in the UK!