Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make 2 buttons inside a table cell be next to each other

I have the following code :

      <td>
        <button class="btn btn-primary btn-xs" ng-click="r.changeView('requests/edit/' + request.id)">
          <i class="fa fa-pencil-square-o"></i>
        </button>
        <button class="btn btn-primary btn-xs" ng-click="r.changeView('requests/edit/' + request.id)">
          <i class="fa fa-step-backward"></i>
          <i class="fa fa-step-forward"></i>
        </button>
      </td>

They appear on 2 different lines.

How can I make them appear next to each other on the same line ?

I tried a few things with float and display but without success.

like image 712
Ellone Avatar asked Nov 20 '15 14:11

Ellone


People also ask

How do I display two buttons side by side in HTML?

If you have multiple buttons that should sit side-by-side on the same line, add the data-inline="true" attribute to each button. This will style the buttons to be the width of their content and float the buttons so they sit on the same line.

How do I make buttons horizontal in HTML?

We can align the buttons horizontally as well as vertically. We can center the button by using the following methods: text-align: center - By setting the value of text-align property of parent div tag to the center. margin: auto - By setting the value of margin property to auto.


1 Answers

If I add that code in a snippet the buttons are next to each other, so it's hard to reproduce:

<table>
  <tr>
    <td>
      <button class="btn btn-primary btn-xs" ng-click="r.changeView('requests/edit/' + request.id)">
        <i class="fa fa-pencil-square-o"></i>Button1
      </button>
      <button class="btn btn-primary btn-xs" ng-click="r.changeView('requests/edit/' + request.id)">
        <i class="fa fa-step-backward"></i>
        <i class="fa fa-step-forward"></i>Button2
      </button>
    </td>
  </tr>
</table>

The buttons are already displayed as inline-block. Maybe the table isn't wide enough; if so, You could try <td style='white-space: nowrap'>.

like image 96
Kenney Avatar answered Sep 20 '22 14:09

Kenney