Find your content:

Search form

You are here

What happens if I use HTML5 docType in Visualforce?

 
Share

By default, SFDC pages (including Visualforce) are served with the DOCTYPE for HTML 4.01 Transitional (!!!) -- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

According the the VF documentation, we can serve VF pages as any doctype we want, including HTML5:

The HTML document type definition (DTD), or doctype, that describes the structure of the rendered page. If not specified, this value defaults to "html-4.01-transitional", which results in a doctype of . Possible values for this attribute include "html-4.01-strict", "xhtml-1.0-transitional", "xhtml-1.1-basic", and "html-5.0", among others. For more information about HTML doctype declarations, see the W3C specifications. -- Documentation for apex:page docType attribute

I'd love to develop my Visualforce in HTML5, but we're using a lot of standard Salesforce styling and formatting. Does the SFDC styling perform well under HTML5? Are there bugs, errors, or strange behaviors you've noticed?


Attribution to: Benj

Possible Suggestion/Solution #1

I haven't noticed anything amiss when using the HTML5 doctype. The whole reason was chosen in the first place is because it was the simplest doctype that would be rendered by browsers in standards mode. This means that html4 markup will display fine under html5. This does not mean that all will be rosy trying to get visualforce to play nicely with html5, as one of the links in your comments illustrate.


Attribution to: Bob Roberts
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4672

My Block Status

My Block Content