How to have a space between the two buttons? And how to align them to center

Arjay Legaspi

I'm using bootstrap from getbootstrap.com. I want to have a space between the SAVE and CLEAR button. I also want them to align center to be proportioned on the textboxes. How can I achieve that?

Here's the photo

<div class="form-group">
  <label for="trucktype" class="col-sm-2">Truck Type</label>
        <div class="col-sm-4">
        <select id="trucktype" name="trucktype" class="form-control" tabindex="2">
          <option value="volvo">Service Wheels</option>
          <option value="saab">Boom Truck</option>
          <option value="mercedes">Crane Truck</option>
          <option value="audi">Pole Trailer Truck</option>
        </select>
        </div>
      </div>

   <div class="form-group">
      <label for="truckloadcapacity" class="col-sm-2">Truck load capacity</label>
      <div class="col-sm-4"><input type="text" name="truckloadcapacity" id="truckloadcapacity" class="form-control" tabindex="3"></div>
  </div>

  <div class="form-group">
    <label for="truckdesc" class="col-sm-2">Truck Description:</label>
    <div class="col-sm-4"><textarea class="form-control" rows="3" id="truckdesc" tabindex="4"></textarea></div>
    </div>

  <div class="form-group">
    <label for="truckphoto" class="col-sm-2">Truck Photo</label>
    <div class="col-sm-4"><input type="file" name="file" id="truckphoto" class="form-control" tabindex="5"></div>
  </div>

  <!-- BUTTONS start -->
  <div class="row">      
  <div class="col-sm-4">
  <div class="form-group">
  <input class="btn-primary btn-lg col-sm-4" type="submit" value="Save">
  <input type="reset" class="btn-default btn-lg col-sm-4" name="clear" value="Clear">
  </div>
  </div>
  </div>
  <!-- BUTTONS end -->
 </form>
this.girish

may be you are looking for this class="text-center" will do a trick, and some CSS for spacing

.btn-spacing 
{
margin-right: 5px;
margin-bottom: 5px !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<div class="form-group">
  <label for="trucktype" class="col-sm-2">Truck Type</label>
        <div class="col-sm-4">
        <select id="trucktype" name="trucktype" class="form-control" tabindex="2">
          <option value="volvo">Service Wheels</option>
          <option value="saab">Boom Truck</option>
          <option value="mercedes">Crane Truck</option>
          <option value="audi">Pole Trailer Truck</option>
        </select>
        </div>
      </div>

   <div class="form-group">
      <label for="truckloadcapacity" class="col-sm-2">Truck load capacity</label>
      <div class="col-sm-4"><input type="text" name="truckloadcapacity" id="truckloadcapacity" class="form-control" tabindex="3"></div>
  </div>

  <div class="form-group">
    <label for="truckdesc" class="col-sm-2">Truck Description:</label>
    <div class="col-sm-4"><textarea class="form-control" rows="3" id="truckdesc" tabindex="4"></textarea></div>
    </div>

  <div class="form-group">
    <label for="truckphoto" class="col-sm-2">Truck Photo</label>
    <div class="col-sm-4"><input type="file" name="file" id="truckphoto" class="form-control" tabindex="5"></div>
  </div>

  <!-- BUTTONS start -->
  <div class="row">      
  <div class="col-sm-4">
  <div class="form-group btn-block text-center">
  <input class="btn-primary btn-lg col-sm-4 btn-spacing " type="submit" value="Save">
  <input type="reset" class="btn-default btn-lg btn-spacing  col-sm-4" name="clear" value="Clear">
  </div>
  </div>
  </div>
  <!-- BUTTONS end -->

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

ConstraintLayout: How to center a text between two buttons of varying sizes

Android Studio how to set buttons to the center and give space between two?

How can I add a space in between two buttons in a boxLayout?

How can I make space between two buttons in same div?

Two buttons vertically misaligning, how to align them properly?

How do I align and space out these buttons?

Create two buttons without space in between them

How to Have Two Fieldsets On The Right And Left Side Of A Page And Then Put Buttons Down The Middle Between Them?

How to style a view component to add space between two buttons?

how to align ul list as a buttons to the center

How can I have two buttons in the bottom using align widget inside the center and column widgets?

How to make the two buttons center?

How to align the buttons at the center of the screen in android

How to center align vertically a text in between two buttons inside a jQuery dialog box?

How do I align two buttons under two different sized DIV's while keeping them responsive?

Two fixed navigations - how to center block between them

How to auto align the buttons to fit in center of the screen

How to center a TextView between two buttons?

How to center align multiple radio buttons in FlowLayoutPanel?

css align element to have the same space between them

How to align the two buttons to the center of a div of 'position:absolute' using flexbox?

Vertical UIStackView: how to keep same space between elements and center them?

How to align two buttons and views left to center, center to right with

Flutter: How to add space between two buttons in a row

How to get the boxes to have evenly space between them?

How to place two blocks in the center of the page dividing it in half between them?

How to make the buttons be centered and have some margin in between them with bootstrap

How do I make text have no space in between them vertically?

How to align and center two divs horizontally and also to make them responsive?