1

I'm working on a very simple validation of getting Bootstrap styles applied to a VF page - I have uploaded Bootstrap 3.3.4 as a static resource, have disabled the header and sidebar, and disabled standard stylesheets...my question is is there some global setting that might be preventing external styles to be applied? This is in a client org and I've simplified it down so much but still can't get the styles to be rendered correctly. I followed this example, ripping the HTML from the actual Bootstrap page as a test.

<apex:page sidebar="false" showHeader="false" standardStylesheets="false" docType="html-5.0">
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>

    <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap/css/bootstrap.min.css')}" />
    <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap/css/grid.css')}" />

  </head>
..... content .....

But it's being rendered with no styles at all:

enter image description here

Here's the directory on my local machine (it was uploaded to static resources as a .zip called "bootstrap"), I believe my URLFORs are structured correctly:

enter image description here

4

Check you base folder. In your screenshot it's named bootstrap-3.3.4-dist while in your URLFOR it's only bootstrap/.

Not sure if the top folder is part of your zip. If not try to remove bootstrap/ from URLFOR

So it should be either

 <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'css/bootstrap.min.css')}" />

or

<apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap-3.3.4-dist/css/bootstrap.min.css')}" />

Btw there is an really awsome (yet unofficial) Firefox plugin to tell you what's really be loaded and what's not. It's called JSView

http://forums.mozillazine.org/viewtopic.php?f=48&t=2863589

2
  • Classic example of me getting frustrated and convincing myself something inexplicable was happening, when it was just overlooking something so simple! Thank you very much Apr 10 '15 at 15:08
  • You are welcome. Without JSView I would end up the same every day.
    – Uwe Heim
    Apr 10 '15 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.