I am new to Visualforce development.

  • I want to style a visualforce page that is part of a site.
  • this page will be customer facing and will allow customers to fill our online application form, this will create a record of a custom object is Salesforce.

What is the best way to approach this? Currently we are using Force.com sites, but we need to get the pages to match the rest of our websites styling, so we have used a custom stylesheet and are currently trying to add 1000+ lines of HTML to the customer facing page. This does feel like the wrong approach.

I know, if I was developing this in PHP I could create a PHP include for our sites header and footer and leave a <div> tag open at the end of the header and close this in the footer. This would then wrap around our visualforce content.

  • Why don't you use CSS?
    – Novarg
    Dec 30, 2014 at 9:07
  • We have to include the companies header and menu etc - so need to include the HTML of the webpage Dec 30, 2014 at 9:17
  • you can store the HTML code somewhere and then use JavaScript innerHTML property to set it up
    – Novarg
    Dec 30, 2014 at 9:31

3 Answers 3


Building sites VF page ,you may need to go through Visualforce tags such as

You can adopt template based approach where you define reusable template and later implement the template .

Some of the best practices is to put all CSS and js in static resource .


You can use apex:component - to use similar styles in different VF pages across your app.


you can upload required css files of your company website into salesforce as a static resource. this uploaded resource is accessible in vf pages and you can use the same styling classes to style your VF page.

You must log in to answer this question.

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