Jump to content


Photo

How to align words in the same table cell?


  • Please log in to reply
6 replies to this topic

#1 TGIF

TGIF
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 30 July 2006 - 03:19 AM

I dont' know too much about CSS. Just wonder how to define style sheet class to align several words on the left and several words on the right in the same table cell?

Another question is: what is the child node of table element?

Thanks a lot!


#2 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 30 July 2006 - 03:35 AM

Why not just use <div align="left"> for the stuff you want on the left, and <div align="right"> for stuff on the right?

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#3 TGIF

TGIF
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 30 July 2006 - 03:43 AM

I tried. It didn't work.

Why not just use <div align="left"> for the stuff you want on the left, and <div align="right"> for stuff on the right?



#4 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 30 July 2006 - 07:57 PM

How on earth does it NOT work?

<table>
<tr><td>
<div align="left">This text is on the left...</div><br>
<div align="right">This text is on the right...</div>
</td></tr></table>

I know that that works.

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#5 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 30 July 2006 - 09:54 PM

i think what he wants is for them to be on the same line.

to do this, you'd need to enable a float on one of the elements:

<table style="width: 500px;">
  <tr>
    <td style="text-align: left;">
    <div style="float: right;">Sample text on the right.</div>
    Some text on the left.
    </td>
  </tr>
</table>

as expected, the stuff in the DIV will float to the right of the regular content.  be sure to place floated elements BEFORE the content you wish to float it next to, otherwise it will have no effect.  for more info on floating/positioning, see:

http://css.maxdesign...orial/index.htm

#6 Unholy Prayer

Unholy Prayer
  • Members
  • PipPipPip
  • Advanced Member
  • 166 posts

Posted 03 August 2006 - 10:03 AM

or you could use this:
<table>
<tr>
<td>stuff</td>
<td>other stuff</td>
</tr>
</table>
That should do the trick.

#7 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 03 August 2006 - 12:43 PM

Please use an appropriate board next time!

Info: PHP Manual





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users