3

I am trying to override the css of the home page and other standard pages. And below is the approach I am following, but seems like I am missing something. Could someone help on this?

Approach:
1. Create a home page component on the left side bar
2. Add the following code to it:

<style>
 { background-color:black !important; 
   background-image:none!important; 
   color:green!important; font-style: bold!important; 
   border:none !important; }
</style>

3. Attach the home page component to the home page layout.
4. Assign the layout.

For some odd reason this is not working for me. Am I doing something wrong?

4
  • did you make sure the show html was checked when you pasted this code in the homepage component – Rao Jun 25 '13 at 20:51
  • Yep, it was checked. – subodhbahl Jun 25 '13 at 20:57
  • 1
    arent you missing the css selector to which you want to apply the css style like body {background-color:black !important; background-image:none!important; }. personally wouldnt recommend to hack the SFDC css, it can get broken by every release – Seb Wagner Jun 25 '13 at 21:06
  • 1 up for the comment. and 1 down for my question! Thanks @Seb_Wagner :) – subodhbahl Jun 25 '13 at 21:25
1

If you still want to mess around with css, this is all you need to do

copy paste this code in your sidebar component :

<style>#bodyCell{background-color:black !important;  background-image:none!important; color:green!important; font-style: bold!important;     border:none !important;}</style>

Based on what area you want to make this style sheet applicable you can select the ID, class here I took the inner tables Id="bodyCell"

how did I get the Id: Go to chrome right click inspect element. Trace over the tree and hit the table / the div in the tree and choose the Id and override the css

enter image description here

5
  • How would it work on pages where there is no sidebar? Is there any work arounds for that? – subodhbahl Jun 25 '13 at 22:24
  • Nope, the basic requirement for this trick to work is that you need to have sidebar enabled.Are you speaking about standard pages that do not have sidebar/ visualforce pages? – Rao Jun 25 '13 at 22:34
  • Beware that this might look neat for the home page but when you traverse through objects you may see the background being applied across the page/ part of the page. You will have to tweak the CSS to be specific to homepage and not traverse across the objects. – Rao Jun 25 '13 at 22:36
  • Yes I am talking about the standard pages like Dashboard or Chatter! – subodhbahl Jun 25 '13 at 22:45
  • Inspect dashboard components top div and apply the css to the div class / ID as specified by inspect element method. – Rao Jun 25 '13 at 23:02

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.