Overlay div position

I have a link in a table cell, and when the link is clicked, I show a hidden div.

I am currently using the position: absolute and z-index: 10. It works fine, but I would like to move it a bit to the beginning and to the left. When I add top: -10px and left: -10px, the div moves to the window position.

How do I make 10px from a table cell?

+3
source share
3 answers

You need to set the parent element using the relative position, and then use the absolute position for the element you want to place . Therefore, if you want it to be based on the table, you need to add a position: relative to the table (which will not do anything because it is already located relatively) and position: absolute for overlay. Absolute positioning removes an element from the document stream, and relative positioning leaves it in the document stream, so the material moves. The reason for this is based on how CSS works: http://www.w3schools.com/css/pr_class_position.asp

relative The element is relative to its normal position, so "left: 20" adds 20 elements to the element. LEFT position

absolute ( )

.

: http://pastehtml.com/view/av391nzsv.html

+10
position: relative;

position: absolute;

, , , .

0

use margin-top:-10px; margin-left:-10px;

0
source

All Articles