简体   繁体   中英

position div from top based on lower left corner

I have some div's in my page that get a transformation applied via panzoom script. I do need to change the height of these divs vith javascript/jquery , and then reposition them in such a way that the lower left corner of the divs remains in the same position and the upper left corner goes up. What I tried is to position them from the top and then removing the height of the div, so that the position is offset().top-DIVHEIGHT. Unfortnuantely due to the transformation and the zooming the position is not as precise as i would need it to be, and when you zoom you see it is off. A better solution would be to give the position of the lower left corner, so I would not have to change its position on resizing. Is that possible?

Thanks

You can give it position: fixed , bottom: 0; and left: 0 , and width and height as needed.

This will fix it to the lower left corner, or if you change the values for bottom and left , keep it constant in relation to the lower left corner. To make it responsive, you can use percentage or vh and vw values for bottom , left , width and height .

If you don't mean the lower left corner of the window, but of the body or a div , you can do the same with position: absolute , with the "anchor" element having position: relative to serve as the reference for the position.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM