SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Anyway to align text on the same line to the opposite side?

    Can somebody tell me if it's possible to take the text in the example below and align it to the right while keeping the text on the same line? I've tried doing this with span and div tags and setting margin and padding to 0, but it keeps putting it on a second line.

    Code:
    <li>text <span style="text-align: right;">this to the right</span></li>
    or

    Code:
    <li>text <span style="padding-left: 10px;">this to the right</span></li>
    John Saunders

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,555
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    You need to float it,
    Code:
    <li><span style="float:right">this to the right</span>text </li>
    You should really give floats a width to be sure they don't take up 100% width. But the baove works on most browsers.

    Paul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •