![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
It keeps its absolute position even though it is nested in the centered div. |
|
The only way I could get the text to keeps it's relative position to the parent div |
|
does anyone know how to nest div elements so they will move with the container? I have tried many, many things and nothing quite fixed or addressed this issue. |
|
I have the following layout for a web page div align="center"><img src="myimage.jpg / div style="position:absolute; left: 274px; top: 287px;">this is some test for reference on the page</div /div the image positions centered on the page just fine and if you stretch the browser windows it remains centered. The text does not. It keeps its absolute position even though it is nested in the centered div. The only way I could get the text to keeps it's relative position to the parent div was to add an outer div, but this caused everything to align right. div align="center" div align="center" style="position:absolute"><img src="myimage.jpg" / div style="position:absolute; left: 274px; top: 287px;">this is some test for reference</div /div /div does anyone know how to nest div elements so they will move with the container? I have tried many, many things and nothing quite fixed or addressed this issue. thanks, Allen |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
[Q]2. The absolutely positioned element takes its position from the position of its closest PA?RENT *positioned* element - [/Q] Is the outer parent div in my example considered an [Q]explicitly positioned parent[/Q] The positions are clear and as I understood them to be. I am using Dreamweaver and if I change the code to look like. div align="center" style="position osition:absolute/relative/static/inherit/fixed"><imgsrc="myimage.jpg / div style="position:relative/static/inherit/fixed; left: 274px; top: 287px;">this is some test for reference on the page</div /div I also tried the outer div without the style tag and none of them get the inner div to hold it position relative to the outer div inside FireFox or IE. When I use position:relative for the inner div it pushes it below the outer div as if it was not nested. If I set the inner div to static/inherit/fixed it keeps it in the outer div but aligns it along the bottom. Is this just not possible with CSS. I cannot find a web site that uses this method. They all seem to center a div inside a parent div. I also found many examples of how to do that, but non that positioned a div relative to its parent. |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
I am trying to align the text over the image. This is a simplified example of what I am really trying to do, which is a menu spread across the image( which is why I need divs) if you were to use the following code (remove the align=center, from the outer div) div><img src="myimage.jpg / div style="position:absolute; left: 274px; top: 287px;">this is some test for reference on the page</div /div The page looks exactly how I would like it. The text is positioned over the image correctly. The image is 800 x 600, this puts the text upper left quadrant. thanks so much for looking at this issue. Allen |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
I just used text as a simple way to test on my box. I am actually using img to create rollover menus. the code you gave works, but only because it is not aligned center. once you add that to the outer div or create another parent div outer/outer div it has the previously described problem div align="center"><img src="myimage.jpg / div style="position:absolute; left: 274px; top: 287px;">this is some test for reference on the page</div /div |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
When I adjust the browser the AP div moves across the screen. |
|
Thanks for taking your time to look at this issue. Please let me know if I have left anything out that you suggested. I have changed the code to exactly your suggestions and I get the same behavior. Shown below, I have the img in a div that is centered and margins set to auto. I have an absolute positioned div on top of the img. When I adjust the browser the AP div moves across the screen. you can also see the page at http://www.nationmanagement.com/test.htm div align="center" style="position:relative; margin-left:auto;margin-right:auto" img src="images/background.jpg" width="803" height="601" / div style="position:absolute;left: 274px; top: 287px;">this is some test to align</div /div thanks for the help Allen |
![]() |
| Thread Tools | |
| Display Modes | |
| |