0

I need to places some buttons in the same line next to each other. Also, I like to put a text input with a button all on the same line.

Here is what I have done

<div class="well">

        <table class="I3WorkAroundTable">
            <tr>
                <td>
                    <div class="inlinebox">

                        <button type="button" class="btn btn-primary scripter_header_button" id="MasterRequestBreak">Request Break</button>

                        <button type="button" class="btn btn-primary scripter_header_button" id="MasterReturnToCampaign">Return to Campaign</button>

                        <button type="button" class="btn btn-primary scripter_header_button" id="MasterRequestLogoff">Logout off Campaign</button>

                        <button type="button" class="btn btn-primary scripter_header_button previewCallOption" id="MasterSkip">Skip this Call</button>

                        <button type="button" class="btn btn-primary scripter_header_button previewCallOption" id="MasterPlace">Place this Call</button>

                    </div>

                </td>
                <td class="I3WorkAroundTableRight">

                    <div class="inlinebox">

                        <div class="input-group">
                            <input type="text" class="form-control" id="MasterAlternativePhoneNumber" style="width: 120px;">
                            <span class="input-group-btn">
                                <button class="btn btn-primary" type="button">Dial</button>
                            </span>
                        </div>

                    </div>

                    <div class="inlinebox">

                        <button type="button" class="btn btn-primary scripter_header_button" id="MasterTransferCall">Transfer Call</button>

                        <button type="button" class="btn btn-primary scripter_header_button " id="MasterAnsweringMachine">Answering Machine</button>

                        <button type="button" class="btn btn-primary scripter_header_button " id="MasterWrongNumber">Wrong Number</button>

                    </div>
                </td>
            </tr>
        </table>

    </div>

However, where I added the following code it, shifted the last 3 buttons to the vertical center of the other buttons.

        <div class="inlinebox">

            <div class="input-group">
                <input type="text" class="form-control" id="MasterAlternativePhoneNumber" style="width: 120px;">
                <span class="input-group-btn">
                    <button class="btn btn-primary" type="button">Dial</button>
                </span>
            </div>

        </div>

Here is my CSS code

.I3WorkAroundTable 
{
  width: 100%;
  padding: 0;
  margin: 0;
}

.I3WorkAroundTableRight
{
  min-width: 180px;
}

.inlinebox
{
  display: inline-block;
  *display: inline;
}

Here are some screenshots to show how they are not aligned enter image description here

enter image description here

enter image description here

UPDATED This is how the page looks inside a page which forces IE8 comparability view

enter image description here

Junior
  • 11,602
  • 27
  • 106
  • 212

1 Answers1

2

All the child elements contained inside your .inlinebox wrappers have varying line heights (some specified with relative units and others set with absolute pixel values) and are set to vertical-align: middle by default. As a quick fix specify the line-height and vertical-align properties on the .inlinebox class:

.I3WorkAroundTable {
  width: 100%;
  padding: 0;
  margin: 0;
}
.I3WorkAroundTableRight {
  min-width: 180px;
}
.inlinebox {
  display: inline-block;
  *display: inline;
  line-height: 1;
  vertical-align: top;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="well">
  <table class="I3WorkAroundTable">
    <tr>
      <td>
        <div class="inlinebox">
          <button type="button" class="btn btn-primary scripter_header_button" id="MasterRequestBreak">Request Break</button>
        </div>
      </td>
      <td class="I3WorkAroundTableRight">
        <div class="inlinebox">
          
          <div class="input-group" style="width: 160px">
            <input type="text" class="form-control" id="MasterAlternativePhoneNumber" >
            <span class="input-group-btn">
                <button class="btn btn-primary" type="button">Dial</button>
            </span>
          </div>
          </div>
        
        <div class="inlinebox">
          <button type="button" class="btn btn-primary scripter_header_button" id="MasterTransferCall">Transfer Call</button>
        </div>
      </td>
    </tr>
  </table>
</div>

I also moved the fixed width on your <input> element to the .input-group.

For better consistency across browsers, and since you're using Bootstrap already, you might consider using the Bootstrap grid for column based layouts instead of using <table>, or use block level elements with float:left instead of trying to align everything horizontally with display: inline-block.

ohneir
  • 409
  • 2
  • 4
  • Thank you for your help. The problem with this site is that it runs inside a viewer. The viewer forces the page to be displaced in IE8 comparability view and I have no way to change that. and when I render the page grids looks wrong for some reason. Your code fixed the issue in modern browser but the issue still exists in the IE8 comparability mode. I updated my question with a screenshot of how it look in the viewer. How can I correct the problem? – Junior Feb 11 '16 at 20:38
  • Also, I can't use this `` otherwise the viewer won't work. – Junior Feb 11 '16 at 20:45
  • With this additional info and your IE8 screenshot it seems like there's a lot more than one issue to work out, using Bootstrap might not even be a good choice for this project? I would start by getting the `.input-group` to be formatted properly in your IE8 viewer, and then worry about the alignment of the additional inline buttons as a second step. These might be helpful: [IE display inline block](http://stackoverflow.com/questions/6703017/ie-display-inline-block), [Bootstrap 3 Horizontal Form / IE8 Support](http://stackoverflow.com/questions/19434538/bootstrap-3-horizontal-form-ie8-support) – ohneir Feb 11 '16 at 21:17
  • If you visit the [Bootstrap 3 documentation for input groups](http://getbootstrap.com/components/#input-groups-buttons) in IE8 compatibility mode are they working properly? – ohneir Feb 11 '16 at 21:18