user6771987
user6771987

Reputation: 37

How to make span appear on each end of a TD

<table width="200pxpx" bgcolor="#00FF00">
  <tr>
    <td>
      <span align="left">1</span>
      <span align="right">2</span>
    </td>
  </tr>
</table>

What I would like to achieve is that 1 appears at the left end and 2 appears at the other end.

So in the script, 1 and 2 both show up at the left end of the TD.

I've also tried to add "align" attribute to make it happen but it didn't work either.

Upvotes: 1

Views: 318

Answers (2)

Joeytje50
Joeytje50

Reputation: 19112

What you're looking for is the css-style float:right.

<table style="width:200px; background-color:#00FF00;">
  <tr>
    <td>
      <span style="float:left;">1</span>
      <span style="float:right;">2</span>
    </td>
  </tr>
</table>

Edit: It's also better to use style for the other styling of your table (this is HTML5 standard I believe)

Upvotes: 1

Tobias
Tobias

Reputation: 424

You can use float.

<table width="200pxpx" bgcolor="#00FF00">
  <tr>
    <td>
      <span style="float:left;">1</span>
      <span style="float:right;">2</span>
    </td>
  </tr>
</table>

Upvotes: 1

Related Questions