How to align a shortcut and select a field vertically (in the middle)

For the CSS guru there, I can’t understand CSS, which makes the first shortcut / selection pair not middle, but the second aligned in the middle.

See the problem in the image below. My goal is to make the first mark / select a pair in the middle and understand the css rules that do this.

enter image description here

<div class="pure">
    <form class="pure-form-inline">
        <div class="pure-g">
            <div class="pure-u labelArea">
                <label>Choose Project:</label>
            </div>
            <div class="pure-u-1-4">
                <select></select>
            </div>
        </div>
        <div class="pure-control-group">
            <label>Choose Customer:</label>
            <select></select>
        </div>
    </form>
</div>

Here you can see it in action ... Fiddle

+4
source share
5 answers

- label , . , , , , , vertical-align, .

label {
    line-height:25px;
}

JSFiddle

+4
label, select {
    display: inline-block;
    vertical-align: middle;
}
+4

:

/* Fix */

.valign:before {
    content:"";
    height:100%;
    display:inline-block;
    vertical-align:middle;
}
.valign > * {
    display: inline-block;

}
.valign-m { vertical-align: middle; }

(.valign) (, )

(select + label)

, .

0
.pure .pure-u {
    line-height:25px;
}
0

div label/select, .

If you remove the unnecessary divaround the first pair label/ selectand add the same class as in the second, you should be fine

<div class="pure">
    <form class="pure-form-inline">
        <div class="pure-control-group">
            <label>Choose Project:</label>
            <select></select>
        </div>
        <div class="pure-control-group">
            <label>Choose Customer:</label>
            <select></select>
        </div>
    </form>
</div>

Changed by JSFiddle

0
source

Source: https://habr.com/ru/post/1543294/


All Articles