Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do I align values in a CSS table based on a point?

How do I set up a table to align a column based on a point? For example; if I had the numbers set { 3.8, 6, 8.23, 10.1, 14 }, each on its own row in a table, and I want the decimal points to line up....

To look similar to:

(*NOTE: "_" are place holders as Yahoo Answers doesn't allow HTML tags (<pre> or <code>) in question details.)

__3.8

__6

__8.23

_10.1

_14

I also would like to be able to line up strings of text:

____8 rainy days

__14 sunny days

____1 snow day

______7 fair days

(lined up based on the word "day")

Maybe a combination of the both? I realize I may have to make two columns to accomplish aligning two separate things.

__12.8%_ like candy

___7%___like vegetables

__57.3%_ like fruit

__22.9%_ like pizza

Lined up based on decimal point and the word "like".

I have to use CSS because the table is on a wiki, and I don't want to have to border-collapse the whole table..

Update:

I've actually figured out a way that I am not 100% happy with, but seems to work for the moment..

{{#vardefine:length|{{#switch:{{lc:{{{2}}}}}|short=2|medium=3|long=4|very long=5|#default=0}}}}{{#vardefine:multiplier|100}}{{#ifeq:{{#pos:{{lc:{{{4}}}}}|frag}}|||{{#vardefine:multiplier|1}}}}{{#ifeq:{{#pos:{{lc:{{{4}}}}}|raid}}|||{{#vardefine:multiplier|1000}}}}{{#ifeq:{{{3|0}}}|0|{{#vardefine:multiplier|0}}}}

|{{{1}}}||<span style="display:none;">{{#var:length}}</span>{{{2}}}||<span style="display:none;">{{padleft:{{#expr:{{#var:multiplier}}*{{{3|1}}}round0}}|4|0}}</span>{{custom popup|static='''{{#if:{{{5|}}}|{{{5}}}|{{#if:{{{3|}}}|( {{#switch:{{#len:{{{3}}}}}|1=<span style="color:#FFFFFF">?? </span>{{{3}}}<span style="color:#FFFFFF"> -?</span>|2=<span style="color:#FFFFFF">? </span>{{{3}}}<span style="color:#FFFFFF"> -?</span>|3=<span style="color:#FFFFFF">? </span>{{{3}}}<span style="color:#FFFFFF"> -</span>|4= {{{3}}}<span style="color:#FFFFFF"> -?</span>|5= {{{3}}} |

Update 2:

It cut me off... I actually whited out some filler characters <span style="color:#FFFFFF">Some characters</span>.... Not 100% what I wanted, but has a very close visual effect unless the user highlights the section.... See working version of what I did at.. http://ddowiki.com/page/Epic_Dungeon_Token

4 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    There are a couple of potential solutions to this, but none are widely supported - at least they've not been since I last investigated this.

    <col alight ="char" char="."> in your table heading

    or use and assign a class to the text

    .tabalight { text-align: "." }

  • Anonymous
    1 decade ago

    Ha Ha I like John F's answer.

    There is only one way to do what your asking and thats dynamically with something server side like PHP or client side like Javascript. Meaning you can not use something static, like HTML or CSS, by itself to accomplish this.

    Since Javascript and PHP is out of the question I wont explain how you could do it that way, instead all I can recommend is hard coding it using the non-breaking space -> & n b s p ;

    Just in case Yahoo messes that up I spaced it, just put it all together. This means you would have to do something like this.

    __& n b s p ;1.00__

    __20.00__

    Shows up as

    __ 1.00__

    __20.00__

    You get what I mean. OR just make sure the decimal is always the same and align the text to the right?

    Source(s): Experience - Computer programmer
  • Anonymous
    5 years ago

    in case you elect the orange textual content textile interior the empty white shadowed bins, why no longer purely substitute the empty white area to orange? in case you do no longer decide directly to do this you are going to would desire to specify the left and appropriate values for the situation, and additionally the top and width of the orange bar to make it slot in that area. for the orange bar you have particular a width of 1130px that's wider than maximum individuals's browser window, that isn't help. are you able to grant a photoshopped occasion of what you're attempting to get it to look like or complex on your description? yet different than for that, for shape i might positioned all your '.lrl' bins down the left into yet another containing div so as that the completed left panel is dealt with as one merchandise by potential of each and every thing around them.

  • Anonymous
    1 decade ago

    1. i dont think this is possible.

    2. I think it would look stupid/ugly that way anyways.

Still have questions? Get your answers by asking now.