How to align amounts right within centered data cells in an HTML table

I have the below HTML. How do I align amounts right within centered data cells in an HTML table .

<table>
    <tbody>
        <tr>
            <td>Name</td>
            <td>&nbsp;</td>
            <td>John Joe Joseph Doe&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;Address</td>
            <td>&nbsp;</td>
            <td>Doestreet</td>
        </tr>
        <tr>
            <td>Amount received</td>
            <td>Amex</td>
            <td>750.00</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>Visa</td>
            <td>250.00&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>Diners</td>
            <td>300.00</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>Total</td>
            <td><strong>1300.00</strong></td>
        </tr>
        <tr>
            <td>Amoungt paid</td>
            <td>&nbsp;</td>
            <td>1250.00</td>
        </tr>
        <tr>
            <td>Change</td>
            <td>&nbsp;</td>
            <td><strong>50.00</strong></td>
        </tr>
    </tbody>
</table>

Open in new window

Errol FarroAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
How to use code tags: [ I have done this for you]
Code tags make your code easier to read. To add code tags.
1. Highlight code
2. Click the code button in the toolbar

To answer your question - you have a number of options
1. Give the cells you want to right align a class (text-right for example) then define the class
.text-right {
  text-align: right;
}

Open in new window

2. If you don't want to do that then you can target specific cells in the table - in this case the last cell
td:last-child {
  text-align: right;
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.