The positioning of the element in jquery?

How to dynamically move an element on the top corner, if div 2 has the property position: relative;
div 3 parent and item number 4 position: absolute;
5affd6310f1f8305562322.jpeg
June 5th 19 at 21:01
1 answer
June 5th 19 at 21:03
Hi, not really understand the task, but something like this:
https://codepen.io/ljutaev/pen/vjvrGB
for a better understanding of positioning read the book David Macfarland - New big book of css
The problem is that green square you want to display in the top corner of the black that is a parent, but the problem is that red has the property position: relative; and height of the parent block is different!Like that Yes, dynamically determine how many pixels go into minus! - lamar commented on June 5th 19 at 21:06
record the height of the block to the variable and instead the value of top: 0 to send back a variable with the height of the block - stan3 commented on June 5th 19 at 21:09
Thank you! - lamar commented on June 5th 19 at 21:12

Find more questions by tags CSSjQuery