Create a section link anchoring the section to the middle of the viewport

Hi there, I’m trying to create a section link which would anchor the section to the middle of the viewport rather than to the top. Is anyone happened to know any straightforward method to do that?

Thanks in advance,
Roy

Hey Roy

Yes you can do that by just creating a new div and position it in the middle of the section. Then link your anchor-link to the new div.

Here’s how you set the position of the div to the middle of the section:

.section {
position: relative;
}

.newdiv {
position: absolute;
top: 50%;
}