Float: can we use it twice for one block of text?

Discussion in 'CSS' started by JamesColin, May 13, 2006.

  1. #1
    Hello,
    I know how to use div style="float: left" in order to have the text wraps around an image for instance.

    But what if I have a long article and two images, can I do this same thing for the top image of the article and the bottom image?

    Could you please explain me how?

    Cheers,
    James
     
    JamesColin, May 13, 2006 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    Floats are a basic building block of modern page layout and design. It would be a Good Thing® to study a good floatutorial.

    cheers,

    gary
     
    kk5st, May 14, 2006 IP
  3. JamesColin

    JamesColin Prominent Member

    Messages:
    7,874
    Likes Received:
    164
    Best Answers:
    1
    Trophy Points:
    395
    Digital Goods:
    1
    #3
    Hello, I've looked into your good floatutorial (thank you) but couldn't find an answer to my question:

    How would I go about doing something like that:
    XXX here is some text
    XXX that goes very well
    around the X div with
    float left but also at YYY
    the end goes aroundYYY
    the Y div with float YYY
    right..

    So have a first DIV with float left at the beginning of the text and another DIV with float right at the end of the text.

    I've looked around for some time, and except by splitting the text in two blocks, and applying one floated div to each text, one left, one right, I don't know the correct way in CSS to achieve the effect with 2 floated div and one text wrapping around the two divs.

    Do you?
     
    JamesColin, May 18, 2006 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    You should work your way through that, and other tutorials a bit more. That is basic and further study will make it a part of your knowledge base. In the meantime, you do exactly as you have suggested.
    
    .right {
        float: right;
        }
    
    .left {
        float: left;
        }
    ==========
    <p>How would I go about doing something like that:<img class="left"
    src="some.jpg" alt="" height="25" width="40"> here is some text that 
    goes very well around the X div with <img class="right" src="another.jpg"
    alt="" width="40" height="25">float left but also at the end goes 
    around the Y div with float right..</p>
    Code (markup):
    cheers,

    gary
     
    kk5st, May 18, 2006 IP