简体   繁体   中英

Change styling of p:selectOneMenu

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 -

在此处输入图片说明

After adding the suggested css.. primefaces selectonemenu is displayed as above on selecting the selectonemenu.

I need to align the highlighted box around the down arrow symbol in the selectonemenu and change the highlighted box color to grey.

Please suggest further modifications. Thankyou in advance.

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

在此处输入图片说明

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.

Some time ago, I've written an article about the problem. It includes a link to a demo project solving many (hopefully most) incompatibilities to PrimeFaces: https://www.beyondjava.net/blog/how-to-use-bootsfaces-and-primefaces-in-the-same-project/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM