I would like to get the same result as below but without the duplication (the same link appears twice):
<html>
<body>
<a href="http://www.w3schools.com">http://www.w3schools.com</a>
</body>
</html>
Is it possible in static HTML without Javascript?
You can do this without duplication using CSS selectors,
by using the attr
function in CSS.
In your style sheet you can add this:
a::after {
content: attr(href);
}
For your example in the question:
<html>
<style>
a::after {
content: attr(href);
}
</style>
<body>
<a href="http://www.w3schools.com">Some text</a>
</body>
</html>
And it displays the link after Some text
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With