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 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    43
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Text not wrapping around image

    Hi, I know this is very basic but I am clearly missing something... I am trying to wrap text around an image. Instead of uploading the site, I threw this code together, which repeats my problem:

    Code:
    <!DOCTYPE HTML>
    <html>
    <head>
        <link rel="stylesheet" type="text/css" href="styles.css" />
    <title></title>
    </head>
    
    <body>
        <div id="column">
        <p>Black-top surfaces deteriorate from exposure to air, sun, rain, freezing weather and snow, from the wear of traffic and from the hardening of the asphalt surface. If this dry, weakened condition is not corrected, cracks and breaks soon appear. Moisture seeps in.
        
        
        
        <img class="floatLeft" src="doit.png" width="200" height="200" alt="doit">
        
        
        The base becomes soft. Traffic churns it up. In low temperatures the moisture freezes and expands, causing unsightly, dangerous holes to develop. Expensive time-consuming replacement becomes necessary.</p>
        </div>
    
    </body>
    
    </html>

    Code:
    body {
        color: red;
    }
    
    .floatLeft {
        float: left;
        margin-left: 125px;
    }
    
    #column {
        width: 300px;
    }
    Here's what it looks like when it's not wrapping:





    Thanks very much for any help.
    Last edited by sterlingcooper; 12-21-2010 at 04:41 AM.

  • #2
    New Coder
    Join Date
    Jun 2010
    Posts
    43
    Thanks
    12
    Thanked 0 Times in 0 Posts
    figured this out... my eyes are just playing tricks on me. should have been img src, then class. Unless there's an easier way?

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,678
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello sterlingcooper,
    src and class can come in either order... it would all work better without that huge left margin though.
    Try it like this -
    Code:
    <!DOCTYPE HTML>
    <html>
    <head>
    <style type="text/css">
    body {color: red;}
    .floatLeft {
    	height: 200px;
    	width: 200px; 
    	float: left;
    	/*margin-left: 125px;*/
    }
    #column {width: 300px;}
    </style>
    <title></title>
    </head>
    <body>
        <div id="column">
            <p>
                Black-top surfaces deteriorate from exposure to air, sun, rain, freezing weather and snow, 
                from the wear of traffic and from the hardening of the asphalt surface. If this dry, weakened 
                condition is not corrected, cracks and breaks soon appear. Moisture seeps in. 
                <img class="floatLeft" src="doit.png" alt="doit"> 
                The base becomes soft. Traffic churns it up. In low temperatures the moisture freezes and 
                expands, causing unsightly, dangerous holes to develop. Expensive time-consuming replacement 
                becomes necessary.
            </p>
        </div>
    </body>
    </html>
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    New Coder
    Join Date
    Jun 2010
    Posts
    43
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Thanks Excavator!


  •  

    Posting Permissions

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