Вопрос:

vertical-align isn't bringing my fields to the top of the DIV

html css alignment vertical-alignment

21 просмотра

2 ответа

0 Репутация автора

I’m trying to align search fields. All my elements are within a parent container, which has the style

#statSearchFields {
    vertical-align: top;
    font-size: 90%;
}

The elements themselves have look like

<div class="searchField">
Start Date<br>
<input type="text" name="start_date" id="start_date" value="06/28/2014" placeholder="Start Date" class="datepicker hasDatepicker">
</div>

but when I put them in my container, they appear off-center. Here is the example fiddle — https://jsfiddle.net/n73ao02h/1/ . How do I bring everything into alignment?

Автор: user6447029 Источник Размещён: 22.08.2016 08:33

Ответы (2)


0 плюса

4762 Репутация автора

vertical-align: top isn't being inherited from your ID. Add the following to your CSS and you will have the results you would expect.

.searchField {
  display: inline-block;
  vertical-align:top;
}

Note: You should remove the vertical-align property from your #statSearchFields ID.

Автор: Robert Размещён: 22.08.2016 08:40

0 плюса

86 Репутация автора

Решение

You have to add vertical-align: top; to the .searchField selector.

Updated jsfiddle: https://jsfiddle.net/n73ao02h/2/

Автор: Paweł Dymek Размещён: 22.08.2016 08:41
Вопросы из категории :
32x32