Manually Override Automatic <html> and <body> Tag Generation
Use the applyHtmlTag and applyBodyTag attributes of the <apex:page> tag to suppress the automatic generation
of <html> and <body> tags, in favor of static markup you add to the page
yourself.
Here’s an example that illustrates how to do
this:
<apex:page showHeader="false" sidebar="false" standardStylesheets="false"
applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
<html>
<body>
<header>
<h1>Congratulations!</h1>
</header>
<article>
<p>This page looks almost like HTML5!</p>
</article>
</body>
</html>
</apex:page>
The attributes act independently of each other; you can use them in any combination of true, false, or unset. When both attributes are set to true, the default, automatic generation of <html> and <body> tags is preserved. When either is set to false, you are fully responsible for adding the corresponding tags to your markup. In this mode, Visualforce won’t prevent you from creating nonsense tag combinations or attributes that give even modern browsers fits.
The applyHtmlTag attribute is available on the
<apex:page> tag for Visualforce pages set to API
version 27.0 or higher. The applyBodyTag
attribute is available on the <apex:page> tag
for Visualforce pages set to API
version 28.0 or higher. They both have the following additional restrictions:
- The showHeader attribute must be set to false for the page, for example, <apex:page showHeader="false">.
- The contentType attribute must be set to “text/html” (the default).
- The values for the top level, or outermost, <apex:page> tag are used; applyHtmlTag and applyBodyTag attributes on pages added using the <apex:include> tag are ignored.