Isha Isha - 1 month ago 44
CSS Question

Change styling of p:selectOneMenu

enter image description here

I have implemented the above selectOneMenu in Bootsfaces and the below selectOneMenu in primefaces.

I need the implementation in primefaces but styling as in bootsfaces.

How can I change the styling of the second selectonemenu as the above selectOneMenu?

I need to remove the grey borders.
Can anyone please suggest me.

EDIT -

enter image description here

After adding the suggested css.. primefaces selectonemenu is displayed as above in the second image.

I need to further remove the line above the text in selectonemenu as there are 2 lines displayed and the down arrow to be in the middle as the image in selectonemenu of bootsfaces.

Please suggest further modifications. Thankyou in advance.

Answer Source

I have following display of the p:selectOneMenu with the custom CSS classes (form-control & radius-none) on my specific screen:

enter image description here

XHTML:

<p:selectOneMenu styleClass="form-control radius-none" ...
...
...

CSS:

.ui-selectonemenu.form-control {
    color: #555 !important;
    display: block !important;
    margin-bottom: 0 !important;
    padding: 5px 10px !important;
    background-color: #fff !important;
    border: 1px solid #ccc !important;
}

.radius-none {
    border-radius: 0 !important;
}

.ui-selectonemenu.form-control .ui-selectonemenu-trigger {
    top: 0;
    right: 0;
    width: 16px;
    height: 100%;
    padding: 0 5px;
    cursor: pointer;
    position: absolute;
    margin: 0 !important;
    border: none !important;
    margin-top: 5px !important;
    background: transparent !important;
}

Update: The other CSS related to .ui-selectonemenu-label and .ui-inputfield is also part of the rendered HTML, which is generic in my case:

.ui-selectonemenu .ui-selectonemenu-label {
    width: 100%;
    border: none;
    display: block;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    margin-bottom: 0px;
    white-space: nowrap;
    font-weight: normal;    
}

.ui-selectonemenu .ui-selectonemenu-label.ui-inputfield.ui-corner-all {
    text-overflow: ellipsis;
}

.ui-inputfield {
    margin: 0;
    padding: 5px;
    background: #ffffff;
    font-weight: normal;
    outline: medium none;
    box-shadow: inset 0 0 0 #8f8f8f!important;
    -webkit-box-shadow: inset 0 0 0 #8f8f8f!important;
}

NOTE: If you want to change the style of all p:selectOneMenu elements in general, then remove the custom classes.