2

I am trying to add a font tag inside label in apex page. on the page i am getting this code in inspect element enter image description here

but in UI instead of getting getting text in red color i am getting the font tag as it is. enter image description here

if anyone can help me with this, it would be great..

3
  • infact i tried to change <font> to <b> but it is also not rendering and the same text is shown on page. this is weird.. Commented Jul 8, 2015 at 18:31
  • 1
    can you paste the VF code, atleast the label part of your VF
    – Rao
    Commented Jul 8, 2015 at 18:55
  • We could offer more assistance if you post your actual VF markup. I'm guessing you attempted to put the <font> tag inside a merge expression, which generally doesn't work as intended. Commented Jul 8, 2015 at 19:24

2 Answers 2

2

Just looking from your screenshot,

<label id="" onclick="" class=""><font color="red">110-32-8633</font></label>

should be changed to

<font color="red"><label id="" onclick="" class="">110-32-8633</label></font>

Reason:

Anything inside of label will be displayed as such in browser unless its not escaped(escape="false").

If you want to apply font to the label, surround that label within the font tag.

I am talking about the rendered html components only. You have to make changes to your visualforce tags accordingly to get the desired output.

Hope it helps.

1

Try using CSS to achieve your red text, like so:

<style>
    .red-label{
        color: red; //might also need !important
    }
</style
...
...
<apex:outputLabel value="{!whatever}" styleClass="red-label" />

You must log in to answer this question.

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