I want to add a "back to top" link after each header. To explain more clearly what I want:
h1::after {
content: "<a href='#masthead'>--->Back to top</a>";
}
The text —>Back to top shows but not as a link
No JavaScript please, pure CSS if possible.
Any solutions for this?
Thanks, Jondo
2
Answers
Unfortunately you cannot add links with CSS
content
. You’d need to add the links in the HTML directly if you are averse to using JavaScript.If you don’t want it to show as a link you can use CSS to remove everything that makes it obvious as a link.
I.e see the CSS below
Ensure to change the color too. HTML
<a>
tags tends to have the default blue color