Home>Article>Web Front-end> Detailed explanation of the use of CSS anchor points (newbies)

Detailed explanation of the use of CSS anchor points (newbies)

烟雨青岚
烟雨青岚 forward
2020-07-14 12:04:47 3072browse

Detailed explanation of the use of CSS anchor points (newbies)

There are two ways to use CSS anchors. I recommend using the following:

到达第一个锚点
到达第二个锚点

我是第一个锚点

我是第一个锚点

In this way, when we click on the A link, the corresponding The DOM node will scroll to the top of the window.

But sometimes our need is not to let it scroll to the top of the window. You may want him to be some distance from the top. This can be solved by the following methods.

到达第一个锚点
到达第二个锚点

我是第一个需要滚动的内容

我是第二个需要滚动的内容

This will achieve the effect of 200px from the top after scrolling. Without affecting the style of the original page

Thank you everyone for reading, I hope you will benefit a lot.

This article is reproduced from: https://blog.csdn.net/baidu_32519511/article/details/52668834

Recommended tutorial: "CSS Tutorial" //m.sbmmt.com/css -tutorial.html

The above is the detailed content of Detailed explanation of the use of CSS anchor points (newbies). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete