Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

General offset for all anchors in HTML?

Tags:

html

anchor

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.

like image 779
Markus Avatar asked Sep 16 '09 08:09

Markus


People also ask

What is offset anchor?

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.

What is offset value in HTML?

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.

How do I stop anchor links from scrolling behind sticky?

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.

What is offsetx and Offsety in CSS?

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.


1 Answers

you could always add another div to wrap around it, and then do something like

.wrapperdiv{
   position:relative;
   top:-10px;
}
like image 71
Mikey Avatar answered Oct 20 '22 07:10

Mikey