Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces 3.5/CSS - selectOneMenu and button vertical align

In Primefaces 3.5 vertical align of p:selectOneMenu and button is weird when you put them in one line. My use case is: user chooses option from menu and then click button to activate it. Issue is - both components have to be in the same line (table row).

XHTML is really easy:

<h:form>
    <p:selectOneMenu>
        <f:selectItem itemLabel="test" itemValue="test"/>
    </p:selectOneMenu>
    <p:commandButton value="GO"/>
</h:form>

Unfortunately result is not what I expect: wrong align

My expectation is rather something line this: wanted align 1 or wanted align 2

I tried to research rendered HTML code with Firebug, but honestly, it's hard for me to found any CSS margin, padding, left, top, or anything like that could help me.

Anyone struggled with such issue (and - hopefully - solved it)?

like image 544
wst Avatar asked Feb 03 '26 17:02

wst


1 Answers

Solution is:

    <style type="text/css">
        .selectMenu { display: inline-block; vertical-align: top; }
    </style>
    <h:form>
        <p:selectOneMenu styleClass="selectMenu">
            <f:selectItem itemLabel="test" itemValue="test"/>
        </p:selectOneMenu>
        <p:commandButton value="GO"/>
    </h:form>
like image 118
wst Avatar answered Feb 06 '26 06:02

wst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!