Using a Custom Doctype | Techila
1401
single,single-post,postid-1401,single-format-standard,ajax_updown_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,qode-content-sidebar-responsive,qode-theme-ver-9.4.2,bridge,wpb-js-composer js-comp-ver-4.12,vc_responsive
 

Using a Custom Doctype

doctype

Using a Custom Doctype

You can specify a different “doctype” (document type, or DTD) for a Visualforce page by using the docType attribute on the<apex:page> tag. This changes the doctype declaration at the beginning of the page. This is particularly useful if you’re working with HTML5, and might also allow you to address browser compatibility issues.

By default, Visualforce pages are served with a doctype of HTML 4.01 Transitional. Specifically, pages begin with this doctype declaration:

1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

You can specify a different doctype for a Visualforce page by using the docType attribute on the <apex:page> tag.

The docType attribute takes a string representing the document type. The format of the string is:

1

<doctype>-<version>[-<variant>]

Where          

·         doctype is either html or xhtml

·         version is a decimal version number valid for the doctype

·         variant, if included, is:

·         strict, transitional, or frameset for all html document types and the xhmtl-1.0 document type, or

·         <blank> or basic for the xhmtl-1.1 document type

If an invalid document type is specified, the default doctype is used.

 

In API 28.0 and greater, the scope of how the docType is determined for a page depends on the entire page hierarchy, not just the main page. When pages are added to the main page using the<apex: include> tag, if any page in the hierarchy is set to docType=“html-5.0”, the entire page hierarchy is rendered in that mode.

Custom Doctype Example

To create a Visualforce page with an XHTML 1.0 Strict document type, use the docType attribute on the <apex:page> tag, and specify a value of xhtml-1.0-strict:

<apex:page docType=”xhtml-1.0-strict” title=”Strictly XHTML”

    showHeader=”false” sidebar=”false”>

    <h1>This is Strict XHTML!</h1>

    <p>

      Blog By Techila Global Services :<br/>

 <apex:image url=”https://c.ap2.visual.force.com/resource/1469806581000/OneStar” alt=”Person icon”/>

    </p>

</apex:page>

 

http://www.techilaservices.com/techilla-oldsite/wp-content/uploads/2016/08/UsingACustomDocType.png

 

 

 

Courtesy: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_styling_doctype.htm

Author: techila

No Comments

Post A Comment