Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust the input size in Bootstrap 4

It seems that the width of select element and input element are equal. How can I make it so that input element would take much more space and select would take less space?

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="input-group mb-3">
  <div class="input-group-prepend">
    <button class="btn btn-outline-secondary" type="button">Button</button>
  </div>
  <select class="custom-select" id="inputGroupSelect03">
    <option selected>Choose...</option>
    <option value="1">One</option>
  </select>
  <input class="form-control">
</div>
like image 847
Anh Pham Avatar asked May 15 '18 04:05

Anh Pham


People also ask

How do I change the size of the input box in bootstrap 4?

Set the heights of input elements using classes like . input-lg and . input-sm . Set the widths of elements using grid column classes like .

How do I change the size of the input box in bootstrap 5?

Just use the 'size' property of input.


2 Answers

Try adding col-* classes in the select and input:

      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
      <div class="input-group mb-3 row">
        <div class="input-group-prepend">
          <button class="btn btn-outline-secondary" type="button">Button</button>
        </div>
        <select class="custom-select col-4" id="inputGroupSelect03">
          <option selected>Choose...</option>
          <option value="1">One</option>
        </select>
        <input class="col-8 form-control">
      </div>
like image 69
K K Avatar answered Sep 26 '22 06:09

K K


You need to add col-* class to your select

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="input-group mb-3">
  <div class="input-group-prepend">
    <button class="btn btn-outline-secondary" type="button">Button</button>
  </div>
  <select class="custom-select col-3" id="inputGroupSelect03">
    <option selected>Choose...</option>
    <option value="1">One</option>
  </select>
  <input class="form-control col">
</div>

.input-group has already .row style so no need to give .row class. if you give .row then it gives negative margin that doesn't need.

like image 33
patelarpan Avatar answered Sep 24 '22 06:09

patelarpan