Log in

View Full Version : text around positioned DIV



andyc209
02-23-2007, 05:13 PM
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

Tristan S.S.
02-23-2007, 08:28 PM
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?

andyc209
02-26-2007, 11:15 AM
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

php-5
02-28-2007, 02:33 AM
I don't think this is possible?? The code must appear in DIV 2 to be centered in DIV2....