Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to change to the HTML5 DOCTYPE?

My site is currently using:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

However, things like Facebook plugins are only valid in HTML5. So, is it safe to change my DOCTYPE to <!DOCTYPE html>? Will this affect anything?

like image 367
Maarten Kuilman Avatar asked Apr 05 '12 14:04

Maarten Kuilman


4 Answers

Yes you can change your DOCTYPE,it will not affect anything that you have already done.In HTML 5 you will get some new features which you can use for your future purpose.Just check this link and you will get some idea about the features present in HTML 5

like image 50
NewUser Avatar answered Nov 08 '22 18:11

NewUser


You can change it. Almost all browsers just look for html in the doctype to ensure they are parsing HTML. It will also remain the same with new versions of HTML.

You might want to do the following quick changes to the head element:

  • Change the meta element to <meta charset="utf-8">.
  • Drop type="text/css" when linking stylesheets and drop type="text/javascript" in script elements as these are the default values.
like image 3
melhosseiny Avatar answered Nov 08 '22 18:11

melhosseiny


Change your DOCTYPE as you said, it shouldn't affect what you've already done in HTML4, but it does give you options of some of the new HTML5 features in future.

like image 1
Martin Oxby Avatar answered Nov 08 '22 18:11

Martin Oxby


The only thing that such a doctype change will affect is validation. Other than that, the doctype declaration only affects browser mode (quirks / almost standard / standard), and XHTML 1.0 and HTML5 doctype have the same effect in this respect.

If you don’t use a validator, there is no reason to change. If you do, you should select the doctype according to which HTML version your document is closer to. Besides, HTML5 validation is completely different from XHTML 1.0 validation (heuristic mixed-strategy checking vs. formal well-defined but limited checking).

like image 1
Jukka K. Korpela Avatar answered Nov 08 '22 17:11

Jukka K. Korpela