Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
how to align two input class on the same line?

I want to align two input classes next to each other with some space in between them like the following image. enter image description here

However, my current output is like this: enter image description here

The html code is

    <div class="form-group">
        <div class="row">
            <label  for="form-workphoneNumber" class="col-sm-4 col-xs-4 control-label">input</label>
            <div id="box" class="col-sm-8 col-xs-8">
                <input type="text" class="form-control" name="workphoneNumber" placeholder="enter">
                <input type="button" class="btn btn-success" value="add" onclick="add_textbox()">
            </div>
        </div>
    </div>
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Just add width and margin

style="margin-right:5px;width:80%;float:left"

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">


<div class="form-group">
    <div class="row">
        <label  for="form-workphoneNumber" class="col-sm-4 col-xs-4 control-label">input</label>
        <div id="box" class="col-sm-8 col-xs-8">
            <input style="margin-right:5px;width:80%;float:left" type="text" class="form-control" name="workphoneNumber" placeholder="enter">
            <input style="width:15%;float:left" type="button" class="btn btn-success" value="add" onclick="add_textbox()">
        </div>
    </div>
</div>

over 4 years ago · Santiago Trujillo Report

0

You can also use display: inline-block instead of float.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">


<div class="form-group">
    <div class="row">
        <label  for="form-workphoneNumber" class="col-sm-4 col-xs-4 control-label">input</label>
        <div id="box" class="col-sm-8 col-xs-8">
            <input style="margin-right:5px;width:80%;display:inline-block;vertical-align:top" type="text" class="form-control" name="workphoneNumber" placeholder="enter">
            <input style="width:15%;display:inline-block" type="button" class="btn btn-success" value="add" onclick="add_textbox()">
        </div>
    </div>
</div>

over 4 years ago · Santiago Trujillo Report

0

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
<div class="form-group">
    <div class="row">
        <label  for="form-workphoneNumber" class="col-sm-4 col-xs-4 control-label">input</label>
        <div id="box" class="col-sm-8 col-xs-8 d-flex">
            <input type="text" class="form-control m-2" name="workphoneNumber" placeholder="enter">
            <input type="button" class="btn btn-success m-2" value="add" onclick="add_textbox()">
        </div>
    </div>
</div>

I suggest you to avloid inline styling and use bootstrap classes for good practices

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!