Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to place text next to an image

    I’m trying to create some code in which there is text on the left and an image on the right and I want them to be next to each other. The thing is, if there is no image I want the text to go across the width of the div. Is this possible? Here is the code that I have been working on:

    Code:
    <div style="width: 220px; border:1px solid #000;">
    <span style="position:relative; float:left; clear:left;">At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium</span>
    <img src="../../Public/Pictures/Sample Pictures/Desert.jpg" style="width:30px;height:60px;vertical-align: top; float:right; clear:right;" />
    </div>

  • #2
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,957
    Thanks
    9
    Thanked 727 Times in 721 Posts
    Try:

    Code:
    <div style="width: 220px; border:1px solid #000;">
    <img src="../../Public/Pictures/Sample Pictures/Desert.jpg" style="width:30px;height:60px;vertical-align: top; float:right; clear:right;" />
    <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium</p>
    </div>

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    851
    Thanks
    11
    Thanked 79 Times in 77 Posts
    Have you tried using Text Wrap? This is Text to the Left code.
    ☠ ☠RON☠ ☠


  •  

    Tags for this Thread

    Posting Permissions

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