I am trying to make the text as a shortcut and select a dropdown on the same line. When I use display: inlinefor div, it works. But when I use the class form-controlin select, it breaks. Here is an example
display: inline
div
form-control
Here is the code
<div class="col-md-2"> <div> <span>test</span></div> <div> <select class="form-control" id="sel1"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </div> </div>
I want to do this on one line.
Add display: flexfor container.
display: flex
.flex { /* become a flex container */ /* its children will be flex-items */ display: flex; /* align items on font baseline */ align-items: baseline; }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> <div class="col-md-2 flex"> <div><span>test</span></div> <div> <select class="form-control" id="sel1"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </div> </div>
flex , decendants , align-items: center, , margin-right , select.
flex
align-items: center
margin-right
select
.input-container { display: flex; align-items: center; } .input-label { margin-right: 10px; }
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/> <div class="col-md-2 input-container"> <label class="input-label">test</label> <select class="form-control"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </div>
Bootstrap, Bootstrap: .
, 2 <div> .row, , , , . :
<div>
.row
<div class="row"> <div class="col-your_break_point_unit"> <!-- your text here --> </div> <div class="col-your_break_point_unit"> <select> <!-- your select options here --> </select> </div> </div>
<div class="form-horizontal"> <label>Country</label> <select> <option>Nepal</option> <option>India</option> <option>China</option> </select>
. - .
Source: https://habr.com/ru/post/1683065/More articles:UseJwtBearerAuthentication returns 401 - .netдержать карусель на одном слайде после обновления - javascriptAndroid - how to show (or select) files using a special extension when calling the "file selector" using Intent.ACTION_GET_CONTENT - androidAndroid - getRunningservices (ActivityManager) is deprecated - javaHow to optimize SQL Server column alignment - sql-serverWhat is the difference between find and firstOrNull? - collectionslegacy_init_op in TensorFlow service - python$ emit event does not work with ng-if - angularjsionic application does not find suppliers in related packaging - node.jsFind if POINT is inside POLYGON in MySQL 5.7 - mysqlAll Articles