skip to Main Content

I need small white space between two text boxes.

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />

<div class="row col-lg-12 col-sm-12">
  <div class="input-group col-md-8">
    <span class="control-label">Product Name*</span>
    <input type="text" class="form-control" placeholder="Product Name" id="productname" required>
  </div>
  <div class="input-group col-md-4" style=>
    <span class="control-label">Short Name*</span>
    <input type="text" class="form-control" placeholder="ShortName" id="shortname" required>
  </div>
</div>

2

Answers


  1. Are you want space between the textbox? i mean in small device it having in two row .so there is add mt-3(margin-top) for below margin to each input-group

    Is this issue?
    enter image description here

    Add mt-3(margin-top) to each input-group and also add a width to span for correct alignment like this span{width:130px;}

    enter image description here

    span{
      width:130px;
    }
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    
    <div class="container-fluid">
      <div class="row">
          <div class="input-group col-12 mt-3">
              <span class="control-label d-flex h-100 align-items-center">Product Name* &nbsp;</span>
              <input type="text" class="form-control"  placeholder="Product Name" id="productname" required>
          </div>
          <div class="input-group col-12 mt-3" style=>
               <span class="control-label d-flex h-100 align-items-center">Short Name* &nbsp;</span>
              <input type="text" class="form-control"placeholder="ShortName" id="shortname" required>
          </div>
      </div>
    </div>
    Login or Signup to reply.
  2. You may use margin or padding class on your span element :

    example

    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />
    
    <div class="row col-lg-12 col-sm-12">
      <div class="input-group col-md-8">
        <span class="control-label px-1">Product Name*</span>
        <input type="text" class="form-control" placeholder="Product Name" id="productname" required>
      </div>
      <div class="input-group col-md-4" style=>
        <span class="control-label px-1">Short Name*</span>
        <input type="text" class="form-control" placeholder="ShortName" id="shortname" required>
      </div>
    </div>

    https://getbootstrap.com/docs/4.5/utilities/spacing/

    Spacing

    Bootstrap includes a wide range of shorthand responsive margin and padding utility classes to modify an element’s appearance.

    How it works

    Assign responsive-friendly margin or padding values to an element or a subset of its sides with shorthand classes. Includes support for individual properties, all properties, and vertical and horizontal properties. Classes are built from a default Sass map ranging from .25rem to 3rem.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search