esel esel -5 years ago 391
CSS Question

Primefaces SelectOneMenu next to InputText is on different vertical position

When I put a Primefaces SelectOneMenu next to a Primefaces Input simply like this, they are not on the same height in the browser (same in Firefox, IE and Chrome):

<!DOCTYPE html>
<html xmlns=""
<h:head />
<f:selectItem itemLabel="Item1" />
<p:inputText value="Text" />

Is it possible (with css) to place those two inputs next to each other, such that they can be shown in one line at the same vertical position?

(I use Primfaces 5.1.)

Answer Source

Try with vertical-align property.

    <p:selectOneMenu style="vertical-align:middle">
        <f:selectItem itemLabel="Item1" />
    <p:inputText value="Text" style="vertical-align:middle" />

Note that it is not necessarily should be middle to make components on the same height. Inspect generated html for selectOneMenu and input, try different values for vertical-align, and find the best variant for you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download