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?
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
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:
meta
element to <meta charset="utf-8">
.type="text/css"
when linking stylesheets and drop type="text/javascript"
in script
elements as these are the default values.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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With