I want to show some text with background and text color, if it is possible through rich text box , then how to set background color and text color, if it's not, then which way i should go ?(trigger/ajax or something else)

I want to apply this settings on custom field of a object

1 Answer 1


Rich text fields store HTML in the backend, so if you save in some relevant HTML that includes some div/spans with some CSS in style attributes you should see the colours on screen.

e.g. store the following HTML into a rich text field (written in via code or some other means, not in the editor itself).

<span style="display: inline-block; background-color: #00f; color: #fff;">Hello, World!</span>

Of course, if you're just talking about displaying text on a Visualforce page there's no reason why you can't just use regular CSS techniques.

  • I want to apply this settings on custom field of a object. In visualforce, its fine.but on salesforce side its difficult.
    – Ankuli
    Commented Mar 18, 2014 at 6:06
  • I am passing this <span> using trigger, so after insert or update of that field , it reflect back as background color and text color. thanks @lacey
    – Ankuli
    Commented Mar 18, 2014 at 13:06

You must log in to answer this question.

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