|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
CSS <div> absolute/relative position
Hi there
![]() I am trying to position my <div>'s relative to where they usually would be in the table cell that they are in, and there should be multiple <div>'s over each other. Basicly I would use position:absolute usually, but these layers I want to position relative to the parent cell - is there a way to do that? thanks for taking your time ![]() |
|
#2
|
|||
|
|||
|
I have not used divs before, but I would like to see your code and maybe this will help me understand how they work.
|
|
#3
|
||||
|
||||
|
Code:
<td valign="middle" align="center">
<div style="position:relative; top:32px; left:32px; visibility: visible; z-index:1;">
<img src="01.jpg" width="32" height="32">
</div>
<div style="position:relative; top:32px; left:32px; visibility: visible; z-index:2;">
<img src="02.jpg" width="32" height="32">
</div>
</td>
this is the extract - for the cell I was talking about. but the two layern aren't showing about over each other, the align as they would without the positioning, just the first one one line above the other one. Hope this helps you to clearify ![]() |
|
#4
|
||||
|
||||
|
Before trying to address your problem, may I suggest you apply code indentation, etc. for an easier to read layout
Code:
<td valign="middle" align="center">
<div style="position:relative;
top:32px;
left:32px;
visibility: visible;
z-index:1;">
<img src="01.jpg" width="32" height="32" />
</div>
<div style="position:relative;
top:32px;
left:32px;
visibility: visible;
z-index:2;">
<img src="02.jpg" width="32" height="32" />
</div>
</td>
Now, relative positioning places the element relative to its initial position in the flow. The original space is left blank. Absolute positioning puts the element in an arbitrary position relative to its container. The original space is closed up. Try changing "position: relative" to "position: absolute" cheers, gary
__________________
There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing. Ask a better question, get a better answer. Last edited by kk5st : August 22nd, 2003 at 12:31 AM. |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS <div> absolute/relative position |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|