gragtajar
gragtajar

Reputation: 35

Display text and button in a <td>

I want to display some text and a button in a <td> element. Text should be left aligned and button should be on the right of the <td>. Both elements should be displayed inline but that is not happening with my code:

<td>Name<br>XYZ<a href=""><button style="float: right">Update</button></a></td>

I tried making display: inline of both text and button but that is not working as well. Please help.

Upvotes: 2

Views: 3641

Answers (2)

Nihal
Nihal

Reputation: 5324

It is working but td width is low that's why you cant see it. give some width to see the effect

table{
    border: 1px solid black;
}
<table>
    <td width="200px">Name<br>XYZ<a href=""><button style="float: right">Update</button></a></td>
</table>

Upvotes: 3

StangSpree
StangSpree

Reputation: 439

Looks like it is rendered the way you want. Try the following fiddle to see the result: https://jsfiddle.net/chaith/7r8kbs4b/

table{
    border: 1px solid black;
    width:200px;
}
<table>
   <tr>
      <td>
          Name<br>XYZ<a href=""><button style="float: right">Update</button></a>
      </td>
   </tr>
</table>

Upvotes: 0

Related Questions