1

I've been doing some searching around and couldn't find this topic anywhere. My company wants to use an HTML doctype but wordpress outputs XHTML by default. I've seen plugins and I would use these but this site will probably outlive the development of said plugins. Plus it's something else to account for when updating or building new sites.

If I use an XHTML doctype how will HTML5 browsers render it? Will they be backwards-compatible with old doctypes?

2
  • I am a little confused on the question... are you asking how to write XHTML? Or the differences between XHTML and HTML? Commented Nov 24, 2010 at 16:02
  • Sorry for the confusion. Wordpress outputs XHTML by default which messes with validation on an HTML doctype. I'm not asking how to write XHTML, just inquiring if using XHTML in the upcoming HTML5 world would be detrimental. Commented Nov 24, 2010 at 16:24

5 Answers 5

2

Edit 1: It is actually recomended that in order to make the transition to HTML5 easier that you try to follow the XHTML structure when writing any HTML.

There will be additional options and types with XHTML in HTML5 but a lot of it is based on the structure in which you are writing your HTML. The X simply means that it is moving to more of an XML base.

To go along with Kayla's input, you will want to make sure that all tags are being closed:

<br/>  Instead of: <br>

You will also want to make sure to put quotations around any parameters:

<a href="value"></a> Instead of: <a href=value></a>

Browsers have been slowly adopting the XHTML structure. This might mean that HTML that is formatted without end tags/etc might look a little different in IE 6 than in newer brower versions. Hope that helps!

Sign up to request clarification or add additional context in comments.

3 Comments

The only browser that does not render XHTML properly is IE which doesn't handle XHTML served as XHTML at all. Unless you meant "tag soup" XHTML which is XHTML served as HTML.
"It is actually recomended that in order to make the transition to HTML5 easier that you try to follow the XHTML structure when writing any HTML" Where is it recommended? There's no justification in HTML5 for any of this.
Yes, you can still write HTML as is and there is no need so follow XHTML best practices for HTML5. It is more to do with the browsers and any other future parser.
2

It is not recommended to use the XHTML 1.0 or 1.1 doctypes for your HTML5 pages, one because its unnecessary and two your markup won't validate when you use the newer tags. Here is a quick guide on using XML syntax in HTML5 a.k.a. XHTML5.

Update: As noted bellow checkout the W3C Specification.

1 Comment

There's nothing quasi about XHTML5. The XHTML serialization of HTML5 is right in the middle of the the HTML5 draft spec. See dev.w3.org/html5/spec/the-xhtml-syntax.html#the-xhtml-syntax
1

I am not sure what you are asking. What do plugins have to do with DTD?

Yes, any browsers that supports HTML5 is backwards compatible with (X)HTML, you can mix and match all you want. And basically as long as you are writing tags like:

<div>Hi</div> or <p>There</p>

instead of

<DIV>Hi</DIV> or <P>There</P>

the rest is just semantics.

1 Comment

If the page is being served as text/html, then it matters not to a browser whether tags are in upper or lower case.
0

HTML5 began life specifically because browsers manufacturers wanted to make sure that changes they introduced were backward compatible with existing web pages, in contrast to the now defunct XHTML 2, which was shaping up to be non-backward compatible.

So yes, your XHTML doctype will work just fine in HTML5 browsers.

Comments

0

As far as I know all modern browsers that are adding HTML 5 support will continue to support HTML 4 and XHTML for the foreseeable future so you should be fine.

If you're using Wordpress though stick with XHTML. It'll be supported for a long time to come in all browsers and most Wordpress plugins are designed to output XHTML.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.