Results 1 to 4 of 4

Thread: text around positioned DIV

  1. #1
    Join Date
    Sep 2004
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default text around positioned DIV

    I have a load of text in a div (div1) with another div (div2) in there containing more text which is positioned to the right using float and all the other text wraps fine around it.

    Roughly :

    xxxxxdiv1xxxxxx
    xxxxxxxxxxxxxxx
    xxxxxxxxxxdiv2
    xxxxxxxxxxdiv2
    xxxxxxxxxxdiv2
    xxxxxxxxxxxxxx
    xxxxxxxxxxxxxx

    problem is I need the code for div2 to be at the end of the page of code for ASP purposes. At the moment it is written in the middle of the main text where I want Div2 to appear...


    <div id="div1">
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In facilisis. Suspendisse eleifend. Integer faucibus. Morbi hendrerit aliquet ligula. In non ipsum. Nunc sapien ipsum,

    <div id="div2">Text for div2</div>

    scelerisque rutrum, sollicitudin a, molestie id, mi. Vestibulum pellentesque sapien eget lectus. Cras egestas, nunc non eleifend consequat, eros felis molestie urna, nec ultrices dui sem vel pede. Curabitur ullamcorper.
    </div>


    what I want is for the code to be like

    <div id="div1">
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In facilisis. Suspendisse eleifend. Integer faucibus. Morbi hendrerit aliquet ligula. In non ipsum. Nunc sapien ipsum, scelerisque rutrum, sollicitudin a, molestie id, mi. Vestibulum pellentesque sapien eget lectus. Cras egestas, nunc non eleifend consequat, eros felis molestie urna, nec ultrices dui sem vel pede. Curabitur ullamcorper.
    </div>

    <div id="div2">Text for div2</div>


    but still have the same result as above.

    The css i have for Div2 is


    #div2{
    width: 175px;
    padding: 10px;
    background-color: #EFEFEF;
    color: #555;
    float: right;
    margin: 0 0 0 10px;
    }


    can anyone help

  2. #2
    Join Date
    Nov 2006
    Location
    90 miles north of Las Vegas
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am not quite sure what you mean, but if you want DIV2 at the end of the page
    remove the css declaration float:right or is this not what you want?

  3. #3
    Join Date
    Sep 2004
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    nope...in the above example to get DIV2 to appear in the middle of the text in DIV1 aligned right I have to place the code for DIV2 in the middle of the code for DIV1.

    What I want is to be able to put the code for DIV2 outside of the DIV1 code but it still position itself within DIV1 aligned right.

    Hope this is a bit clearer

  4. #4
    Join Date
    Feb 2007
    Location
    North Vancouver, BC, CANADA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I don't think this is possible?? The code must appear in DIV 2 to be centered in DIV2....

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
  •