1

On a Visualforce app, I have a pageBlockSection with a title provided by a facet header:

<style> .red {color: red;} .green {color: green;} </style> <apex:pageBlockSection id="pbs"> <apex:facet name="header"> <apex:outputPanel styleClass="{!IF(variable1=='Positive','green','red')}">Uncoloured: Coloured</apex:outputPanel> </apex:facet> </apex:pageBlockSection> 

And right now it comes out as entirely green or entirely red. How could I make it so that only the second half appear as coloured whilst the first half remains black. e.g. Uncoloured(black): Coloured(red/green).

1 Answer 1

1

You can have multiple elements inside the apex:facet, so you just need to shuffle some things around. Also, the apex:outputPanel is unnecessary here; you can use merge syntax in normal HTML, too.

<apex:facet name="header"> Uncoloured: <span class="{!IF(variable1=='Positive','green','red')}">Coloured</span> </apex:facet> 
1
  • This worked perfectly, thank you very much! Commented Apr 2, 2023 at 18:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.