<table class="table"> fill 100% of the width of the container. The width of the column is divided in proportion to the width of its contents.
When the left side requires most, the button column will be "short."
When the left side has a smaller part, the button column will increase, thereby making the buttons "move to the center".
To solve: Set the width of the right column with a fixed value. The total value of the combined width of all three buttons: width:125px . As below:
<div style="width: 500px"> <table class="table table-striped"> <tbody><tr> <td>Test text</td> <td class="text-nowrap" style="width:125px;"> <div class="btn-group"> <button class="btn btn-default"><span>A</span></button> <button class="btn btn-warning"><span>B</span></button> </div> <button class="btn btn-success"><span>C</span></button> </td> </tr> </tbody></table> </div>
See: http://www.bootply.com/PGL6xCDgMz
This will set the button column width to a fixed value of 125 pixels. Thus, the left column will leave the rest of the remaining part.
Update 1: (according to commentator comments)
- method 1:
<div style="width: 500px"> <table class="table table-striped"> <tbody><tr> <td>Test text</td> <td class="text-nowrap"> <table cellpadding="0" cellspacing="0"> <tr> <td><button class="btn btn-default"><span>A</span></button></td> <td><button class="btn btn-warning"><span>B</span></button></td> <td><button class="btn btn-success"><span>C</span></button></td> </tr> </table> </td> </tr> </tbody></table> </div>
- technique 2:
<div style="width: 500px"> <table class="table table-striped"> <tbody><tr> <td>Test text</td> <td><button class="btn btn-default"><span>A</span></button></td> <td><button class="btn btn-warning"><span>B</span></button></td> <td><button class="btn btn-success"><span>C</span></button></td> </tr> </tbody></table> </div>
Nik
source share