Friday , February 7 2025

Anchor link and smooth transition

This case is used for landing pages, for pages with a lot of content. The default anchor link looks like this:

<p><a href="#mylink">Anchor link </a></p>
<div id="mylink"></div>

Sometimes, instead of <div id=”mylink”></div> this code <a name=”mylink”></a> is used, the result will be the same, but w3c validators will complain about the missing href.

In this example, the transition will be instant, but now the trend is smooth transitions, beautiful flips and other features.

The solution is mega simple, in css add this one:

html {scroll-behavior: smooth;}

About iryna

I'm Iryna, a web developer from Ukraine with a decade of experience solving complex technical challenges in the world of freelance. Throughout my career, I've worked on everything from troubleshooting server-side issues and optimizing website performance to enhancing user interfaces. On this blog, I share detailed solutions to the technical problems I’ve encountered and methods that have worked best for me. In addition to my technical expertise, I’m also passionate about digital drawing. I hope the tutorials and insights I provide here will help both fellow developers and creatives alike in their own projects.

Check Also

Css styles for WordPress admin in functions.php

If you need to add individual styles, and they are only a couple of lines, …

Leave a Reply

Your email address will not be published. Required fields are marked *