2

Inline css is working. But I'm unable to call from an external css the same code.

Following is in VF..

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

And my style.css content in Static Resource...

  <style type="text/css">
   div.col1{
   background-color: #ccffcc;
   }
   div{
       float:left;
      }
       div.border{

      border-style:outset;
      border-width:6px;
      }
     .errorClass {
      background-color: red;
     }
    .normalClass {
     background-color: green;
     }
    .inProgressClass {
    background-color: #33CCFF;
    }
   .centerClass
    {
    align:center;
   }
  </style>
  • What exactly you can't call? A whole css file or just individual classes? If it is a whole css file problem i think this is related to the question about adding images (look here) – Sergej Utko Apr 17 '14 at 10:09
  • I have a color coding in a data table where "errorClass ", "normalClass" colors a cell. I have no images. If I paste it inside VF, it works, but if I use it in static resource nothing happens – MnZ Apr 17 '14 at 10:12
2

URLFOR is used when style sheet exist under zipped folder. In your case try this:

<apex:stylesheet value="{!$Resource.style}"/>

  • Yes @jaffer. You are correct. It's working – MnZ Apr 17 '14 at 10:13
  • 2
    Cool..Please mark it solved so other can see .. Cheers :) – Jaffer Ali Apr 17 '14 at 10:14
  • Wait for 3 more minutes :P – MnZ Apr 17 '14 at 10:16
  • 29 minutes are gone:P – Jaffer Ali Apr 17 '14 at 10:46
  • I'm sorry. Done =) – MnZ Apr 17 '14 at 12:05

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.