I have Change the color using CSS. But i want change the color on one particular pageblocksection. How can i do that. I tried several methods, but does not work. Thanks
<apex:pageBlockSection title="Add Batch 3" collapsible="true" columns="1" id="section1">
<apex:pageBlock >
//Stuff
</apex:pageBlcok>
</apex:pageBlockSection
**CSS**
html .brandTertiaryBgr {
background-color: #1A1A56!important;
color: #FFFFFF!important;
font-weight:bold;
font-size:14px;
margin-bottom:20px;}
By using above css code I would be able to change colours in all my pageblockSections. I used below method to change color, It does not work either`.
<apex:pageBlockSection title="Add Batch 3" collapsible="true" columns="1" id="redSection">
<apex:pageBlock >
//Stuff
</apex:pageBlcok>
<script>colorPageBlock(document.getElementById("{!$Component.redSection}"), "red");</script>
</apex:pageBlockSection
JavaScript
<script>
function colorPageBlock(pageblock, color) {
if (pageblock != null) pageblock.firstChild.style.cssText = “background-color: ” + color + “;”;
}
</script>
Is there any otherway I can Change my pageBlockSection Color? Only for one. Thanks
Best Answer
Wrapping the
apex:pageBlockSection
in an element that a CSS class can be added to works:producing this output:
PS
To style the headers you can make use of a CSS descendant selector:
where
pbSubheader
is a class applied by the Visualforce framework to the header.