I would like to know, how to change the background-color
of a p:selectOneMenu
.
I have tried this
<p:selectOneMenu value="Select One" style="background-color:red" >
<f:selectItem itemLabel="Select One" itemValue="" />
.....
But the background is still white.
Try panelStyle
attribute as given below:
<p:selectOneMenu value="Select One" panelStyle="background-color:red" >
<f:selectItem itemLabel="Select One" itemValue="" />
The visual appearance is determinated by a surrounding <div>
and a <label>
. The easiest way is to give 'red' background to "everything" inside your p:selectOneMenu
:
<p:selectOneMenu value="Select One" styleClass="redSelect">
while in your <h:head>
:
.redSelect > * {
background: red;
}
In addition to change the background of the drop-down menu, overwrite the background property of the following CSS class combination:
.ui-selectonemenu-items.ui-selectonemenu-list {
background: red !important;
}
这是正确的答案:
.ui-selectonemenu input.ui-selectonemenu-label{ background: red; }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.