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
Manu@devManu@dev 

Changing the background and text color of the apex command button

Hi,

I have written a style class as follows
.myButton {
color: white;
background: #006DCC;
border-left: 0px;
border-top: 0px;
border-bottom: 0px;
border-right: 0px;
width: 60px;
height: 22px;
}

The above class is for the following button -
<apex:commandButton value="Show Features" styleClass="myButton" />

But the button formatted with color and background. All remaining properties applied to button. When I do inspect element, I am seeing that color and background properties were striked out.

Can someone help me in chnaging the text color and background color of the button.

Thanks,
Manu

 






ShashForceShashForce
Hi,

Please try putting myButton style class between the style tag, something like this:

<style type="text/css">
.myButton {
color: white;
background: #006DCC;
border-left: 0px;
border-top: 0px;
border-bottom: 0px;
border-right: 0px;
width: 60px;
height: 22px;
}
</style>
ShashForceShashForce
You can also try using div:

<div class="myclass"><apex:commandButton value="Show Features"/></div>
Manu@devManu@dev
Thanks for your reply..but unfortunately, I am still not getting the exact output. I already included my style class inside the <Style></style> tags and now as per your latest suggestion i used added my apex command button inside <div> tags

<div class="btn-primary1"><apex:commandButton value="Show Features" action="{!displayFeatures}"/></div>

...but still the text color of "Show Features" is not changing. I think there is some problem with those CSS attributes which I have used?

R - Manu



Manu@devManu@dev
One more thing here..when I applied my style class for div, the entire div background gets changed but not the button background.

R - Manu