We help IT Professionals succeed at work.

Trying to set apex:outputtext font properties

I am trying to add bold font formatting by using the style attribute.  I am able to set the style to italic, or the color to red, but not the font-weight;

<apex:pageBlockSectionItem >
                <apex:outputText style="font-weight:900;" value="This text should be in BOLD" />
                <apex:inputField value="{!Opportunity.Test_Field__c}"/>
</apex:pageBlockSectionItem>


I also tried adding the escape="true" attribute, but wasn't able to add <B></B> tags.
Comment
Watch Question

techhealthDirector
CERTIFIED EXPERT

Commented:
That should work.  In fact I just verified with a test page and it worked fine for me.  Can you post the entire page code?  Some other parts may have screwed up your style.

Author

Commented:
I have attached a file with the relevant code.  The entire page is over 600 lines, so I only included the section that I'm working on. apex-sample.txt
Director
CERTIFIED EXPERT
Commented:
Interesting... looks like styling on label doesn't work appropriately once there's an inputField or inputText in the same pageBlockSectionItem.  If you put them separately in two pageBlockSectionItems, the styling works (see below).  However that would make positioning harder for your label and input box.

<apex:pageBlockSectionItem ><apex:outputLabel style="font-weight:bold;" escape="true" value="This text should be in BOLD" for="txt1"></apex:outputLabel>
      </apex:pageBlockSectionItem>
  <apex:pageBlockSectionItem labelStyle="font-weight:bold;" dataStyle="font-weight:bold;">        
      <apex:inputtext value="{!Description}" id="txt1"/>
  </apex:pageBlockSectionItem>

Open in new window

Author

Commented:
Thank You!