Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a question about the meta tag content-type. When starting to build my site (HTML+PHP+JS), I copied a lot of the meta tags over from elsewhere, and I have, amongst others, the following:

<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />

Now, I've seen that tag is being used a lot with the value "text/html". I've been searching the web but could not find a comprehensive explanation regarding what the difference between both is. The "text/html" intuitively sounds more straightforward to me.

Should I change my tag to that, or might the "application/xhtml+xml" be an equivalent solution ?

Alternatively, can anyone point me to a resource where the different values for these tags are listed and explained in a clear manner?

Thanks in advance

share|improve this question

1 Answer 1

up vote 6 down vote accepted

You can find the full answer here: http://www.w3.org/TR/xhtml-media-types/#intro. However in brief, application/xhtml+xml is for XHTML. That document recommends using HTML 4.01, but I recommend using HTML 5 since there is widespread support for it now. The content type for HTML 5 is

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Change the charset to whatever you're using. If you don't know or don't want to understand what you're using then just leave it as utf-8 and most things will work.

(The HTML vs XHTML debate is long and complicated, so I won't even attempt to summarise it.)

share|improve this answer
    
+1. The usual HTML5 way is to serve the content with an HTTP header identifying it as text/html (rather than an equivalent in the markup itself) and to use <meta charset="utf-8">. –  Charles Jun 29 '11 at 15:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.