1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Vertical alignment of text that is right-aligned - not working??

Discussion in 'Web Design & Development' started by JiminSA, Jan 16, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    3,350
    First Name:
    Jim
    I have a CMS which I am using to develop an in-house accounting system. But have encountered a small problem with alignment... If I use the following in-line styling, the vertical alignment seems to default to bottom:confused:
    Code:
    <p style=\"text-align:right; vertical-align:text-top;\">" . $row["amount"] . "</p>"
    this piece of code is included in an array submitted to the CMS via php, hence the escape characters.
    The rendered mis-alignment can be seen in the attached thumbnail. Ideas anyone?
     

    Attached Files:

  2. colinsp

    colinsp

    Joined:
    Sep 5, 2007
    Messages:
    2,271
    First Name:
    Colin
    Jim

    It doesn't work like that. Rather than go into detail here (I am lazy when it comes to typing) see this.
     
  3. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    3,350
    First Name:
    Jim
    Yes Colin, I checked out that link when I was trying to sort this anomaly out, but I can't see the wood for the trees... I'm a bit doff when it comes to tables and alignment etc., but it appears to me that you can't set a vertical alignment and a horizontal at the same time, at least not the way I was trying...
     
  4. colinsp

    colinsp

    Joined:
    Sep 5, 2007
    Messages:
    2,271
    First Name:
    Colin
    Simplistically vertical alignment only works in tables and not div's. So if you follow Method 2 on that link you should be good to go. Create an appropriate class in your css and apply that class to your p tag where you are having problems.
     
  5. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    3,350
    First Name:
    Jim
    It's not quite that straight forward, Colin - the hack I did was to persuade some numeric text strings to align right in a table cell, but having achieved that, they dropped to vertically align themselves bottom and I was attempting to vertically align them top in the cell - but the CMS's css can not be overridden that way, it seems..
     
  6. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    3,350
    First Name:
    Jim
    I have settled for using str_pad to do the alignment as I cannot get table cell vertical alignment to override the CMS's table cell alignment, no matter what:confused:
    ... and now I am discovering that what php.net say about how str_pad operates, is not what actually happens:mad: So I shall be starting another thread about that;)
    But thank you Colin for your patience and input(y)
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1085459

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice