SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot PixelPaul's Avatar
    Join Date
    Nov 2003
    Location
    Wisconsin, USA
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    left and right align together

    I have a fixed sized <div> in which I would like to have an image aligned to the left side, and some text aligned to the right side. Not sure how to get this done. Can anyone help?

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Give the image the property of float: right and the text the property of float: left. You'll also need to add something invisible that isn't floated in the DIV, otherwise it won't display in certain browsers.

    Hope this helps

    -Sam
    Sam Hastings

  3. #3
    Guru Meditation Error gnarly's Avatar
    Join Date
    Dec 2003
    Location
    Cheltenham, United Kingdom
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PixelPaul
    I have a fixed sized <div> in which I would like to have an image aligned to the left side, and some text aligned to the right side.
    Would something like this work for you?

    HTML Code:
    <div>
    <p><img style="float: right; margin: 0 0 5px 5px;" />Some text goes here.</p>
    <div style="clear: both;">&nbsp;</div>
    </div>
    That last clear: both; div is to stop the image falling out of the bottom of the main div.


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
  •