left-right-center aligned

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

  Is it possible to have each column cell in a table to be left-aligned
with each other, but also right-aligned with the cell based on the
longest content.

So a table like...


...could be output like...

      ______Left align
[[   aaa   ][bbb      ]]
[[   aaaaaa][bbb      ]]
[[   aaaaa ][bbb      ]]
        |___Right align as a group
             to the center of the table

...at the moment, the closest I have is right-aligning the TD, and in
that, having a left-aligned SPAN where I set the em width manually -
but as the page is generated dynamically, I can only really guess what
that'll be.

Thank you for any help,

Re: left-right-center aligned

mre wrote:

Quoted text here. Click to load it

Just make sure the cell width is small enough to have the
largest content touch the right side of the column, and then
left-align with a left padding?

http://locusmeus.com /
Sonhos vem. Sonhos vo. O resto imperfeito.
                             - Renato Russo -

Re: left-right-center aligned

Quoted text here. Click to load it

Hi Els, thank you for the response.

    Sorry, I should also have mentioned in my previous post that my
table width was 100% and columns were 50% each

  I tried playing around with different ideas based on your reply, and
the best I came up with this (below) - are there better ways? I don't
know how to make something small enough to fit the largest content -
how's it done? - or was that response based on the fact that I'm an
idiot and forgot to mention the width of my table/cells?

<table style="width: 100%;">
 <td width="1px"><div style="white-space: nowrap;">abc def</div></td>
 <td width="50%">fdsafd</td>
 <td width="1px"><div style="white-space: nowrap;">a b c</div></td>
 <td width="50%">fdaf</td></tr>

Thank you for your help :)

Site Timeline