Results 1 to 2 of 2

Thread: how to float text to the right and link to the left

  1. #1
    Join Date
    Aug 2008
    Location
    London
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default how to float text to the right and link to the left

    I have a footer where I need to have text floated to the right and a link floated to the left on the same line.

    I put the text and the link in the unordered list and applied the following css to display them inline:

    #footer ul li{
    display:inline
    }

    Then I applied float right to the link but it causes the link to move one line down. Is it possible to do it using float or should I use padding and margines in order to do it?

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    HTML Code:
    <ul>
    <li class="right">Text</li>
    <li><a href="#">Link</li>
    </ul>
    CSS:
    Code:
    ul {
      margin:0;
      padding:0;
      list-style:none
    }
    
    li {
      display:inline
    }
    
    li.right {
      float:right;
    }
    Basically, the "floated" element should appear first in your markup. I'm pretty sure this is a Firefox-only bug. Most other modern browsers should display your footer properly with the styling you have now.

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
  •