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 2 of 2

Thread: Text align: css

  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text align: css

    i'm having problem aligning text around an image using css. The code I have used so far which renders fine in internet explorer is as followed:

    Code:
    <div style="float:left;">&nbsp;<img src="http://www.hollihomes.com/images/guardarmar.png" /></div>
    <div style="float:left;margin-left:3px;">Guardarmar is a select seaside resort on the Costa Blanca.
    <p>Whilst only twenty minutes drive from Alicante airport, Guardarmar is famous for it's pine forest and it's long sandy beaches with safe bathing.</p>
    <p>Brand new luxury fourth floor apartment only a stroll away from the beach.</p></div>
    <div style="clear:both;"></div>
    you can view an example of the page here

    note: it does work fine in ie, so check it out there to see what I want it to look like, thanks!

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    You've got two block level elements floated, none of which have a width assigned. Therefore each one takes up the width of the containing block, so float or no float the blocks don't wrap. Either apply the style to the image itself and don't put it in a <div> (img is an inline element), or give at least one of the <div>s a width enough to let both containers fit.

    Hope this helps...


  •  

    Posting Permissions

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