You might be wondering why this article is found on this site CSS-FAQ when it practically deals on CSS. Well, it will not take an Einstein or a Pasteur to find out the answer. The reason is that your choice of markup language will dictate and affect the manner by which you apply CSS in some cases. I guess you don’t want to be caught off guard on those cases, right? So, would be advisable for you to give attention to this article.
Now that the motive has been well established, it is now time to go to business.
Technically, the heart of the difference between HTML and XHTML is that HTML or Hypertext Markup Language is based on SGML or Standard Generalized Markup Language. This lets designers to make use of attribute minimization. Meanwhile, XHTML or Extensible HyperText Markup Language is one founded on the concept of XML or Extensible Markup Language which does not allow designers to remove tags and make use of attribute minimization.
However, it does allow shorthand notation for empty elements. One good example is we could use <br/> instead of <br></br>—which HTML does not allow. XML document must have a start tag and an end tag to work properly. The nested tags should be closed in the right order, too.When an XML parser encounters an error relating to the document’s well-formedness, it must abort, whereas an HTML parser is expected to attempt to recover and continue.
Verily, there are three aspects of differences between HTML and XHTML that affect our use of CSS: case sensitivity, optional tags and properties for root element. But it must be borne in mind that these differences are relevant only when XHTML document is served as an application of XML. This means there is a MIME type of application/xhtml+xml, application/xml, or text/xml. The MIME type of text/html should be parsed and interpreted as an HTML document. Thus the HTML rules apply in this situation. A style sheet written for an XHTML document being served with a MIME type of text/html may not work as intended if the document is then served with a MIME type of application/xhtml+xml MIME Types.
Your knowledge on these differences will prove to be productive in case you are serving HTML documents as text/html. If you were still unaware of the differences, you might write CSS stylesheets which might not work properly the way you want them when the document is served as real XHTML.



english
español
Deutsch
français
Italiano
Português
русский










Beantworten