function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
prati@salesforceprati@salesforce 

formatting text in output label

Hi folks,
  I am using outputLabel to display some text in my visualforce page. But I wanted to format only a part of the text and make it bold or change its color. I tried using CSS but it formats the everthing inside outputLabel. How can I only format a portion of it?

Thank you
Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior
Hello prati@salesforce,

Try using a span tag inside your label. Please, refer to the code below:
 
<apex:page standardController="Account">
    <style type="text/css">
        .my-class {
        font-weight: bolder;
        }
    </style>
    <apex:form >
        <apex:outputLabel><span class="my-class">Hello</span> World!</apex:outputLabel>  
    </apex:form> 
</apex:page>

Regards.

Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.