Is is possible to specify DOCTYPE in Salesforce visual force components? How can DOCTYPE affect the responsiveness of the component (If we have given some styling/responsiveness to the UI)

Any suggestions would be helpful!

  • did you try or read the documentation? Please limit your posts to only 1 question as mentioned in How to Ask Thanks
    – glls
    Commented Jun 26, 2017 at 19:21
  • You can only add that attribute to pages.
    – Adrian Larson
    Commented Jun 26, 2017 at 19:26

1 Answer 1


HTML only allows a single DOCTYPE for a page. Accordingly, you cannot specify a DOCTYPE for a single element. DOCTYPE will generally have little effect on performance, but may cause other complications. For example, if you use an XHTML DOCTYPE, you'll be forced to verify all your code is perfectly XHTML compliant or the entire page will fail to load. Generally speaking, you should use either no DOCTYPE (for HTML4), or HTML5. Other types tend to be quirky and may cause undesirable graphical glitches or parsing errors.

  • thanks ! So, If I have some problem viewing the responsiveness of the component in a mobile, can this be solved using a doctype ? Because, as we cannot use this in visual force component what can be the solution for this? Commented Jun 27, 2017 at 4:07
  • @kkbandi No, changing the DOCTYPE won't likely fix anything. If a component isn't responsive, it's likely a CSS problem.
    – sfdcfox
    Commented Jun 27, 2017 at 4:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .