I have some anchor elements, but they are in absolute position div and the content of the div is so large that it scrolls inside (overflow:auto).
All entries in the div have an anchor on top, but if I go to this anchor I have the element I wanted to directly on top of the side, but I want it in the center. I need something like an offset so I can jump higher than normal.
The offset-anchor CSS property specifies the point inside the box of an element traveling along an offset-path that is actually moving along the path.
Definition and UsageThe offsetTop property returns the top position (in pixels) relative to the parent. The returned value includes: the top position, and margin of the element. the top padding, scrollbar and border of the parent.
You could add the scroll-padding-top CSS property to an HTML element with a value of 4rem . Now when you click the anchor link, the browser jumps to the anchor section but leaves padding of 4rem at the top, rather than scrolling the anchor point all the way to the top.
offsetx and offsety in cssoffset-x : how far to push the shadow horizontally from the element. offset-y : how far to push the shadow vertically from the element.
you could always add another div to wrap around it, and then do something like
.wrapperdiv{
position:relative;
top:-10px;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With