Pergunta

I have an XHTML 1.0 Strict site. I'd like to swap over to HTML5. From what I've read, it's almost like XHTML could be considered a subset of HTML5, i.e. update the DOCTYPE and the encoding tag and it'll be fine as HTML5.

Is that right? Are there any massive gotchas I should look out for?

Foi útil?

Solução

Because HTML 5 was developed with backwards compatibility in mind, both HTML and XHTML syntax are permitted. Changing the DOCTYPE to <!DOCTYPE html> should be enough.
If your website is valid as XHTML 1.0 Strict and is served with an application/xhtml+xml media type, you can convert it to XHTML 5 simply by removing the DOCTYPE.

Outras dicas

No, HTML5 does not have to be valid XML, so HTML5 and XHTML are different. Browsers are usually tolerant to markup that strays away from the standards declared in the DOCTYPE. If your XHTML doesn't use any of the features of the 'X' (ie. extensible) then conversion may be very straightforward. If you have used the extensible features then those parts may well be ignored by a browser. Yet another standard, XHTML5, is in the pipeline!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top