html - Why does using an input group break the baseline alignment in bootstrap? -


If I have a label next to an input, in plain HTML, and both inline (or inline blocks), then They are allocating by their baseline. But when using bootstrap, input input into the input group, it seems that they all combine below.

I tried to repeat it without bootstrap, but I can not, it just works. I made the bela to show this problem:

HTML is:

   & Lt; / Div & gt; & Lt; Hours / & gt; & Lt; P & gt; A broken case from a similar HTML structure, but not the use of bootstrap:  & Lt; Period & gt; Add-ons & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Hours / & gt; & Lt; P & gt; Broken position, with input group: & lt; / P & gt; & Lt; Div class = "form-group with input-group" & gt; & Lt; Label & gt; Label & lt; / Labels & gt; & Lt; Div class = "input-group" & gt; & Lt; Input type = "text" class = "form-control" value = "value" /> & Lt; Span class = "input-group-connector" & gt; Exchanges & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

and CSS:

 . Without input-group input {max-width: 250px; Display: Inline-block; } .without-bootstrap .group {max-width: 250px; Display: Inline-table; }. Unbootstrap Group Input {Display: Table-Cell; } .without-bootstrap Group Period {Performance: Table-Cell; } .with-input-group .input-group {max-width: 250px; Display: Inline-table; }  

because the input group displays: inline-table; and the label is outside the input-group If you inspect the input-group-element, you can see that it is display: table-cell; and vertical-align: center; Is set to . If you move the label inside the input-group and style, then in the form of an input-group-addon it is exactly the same as lines.

  & lt; Div class = "form-group-in-input-group" & gt; & Lt; Div class = "input-group" & gt; & Lt; Label & gt; Label & lt; / Labels & gt; & Lt; Input type = "text" class = "form-control" value = "value" /> & Lt; Span class = "input-group-connector" & gt; Exchanges & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

.

 . Input-group label {padding: 4px; Exhibit: Table-Cell; Vertical-row: middle; }  


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -