-1

Tell me how to add href to a link via CSS. How to do it in the standard way is clear.

<div>
<a href="example.com">Button</a>
</div>

But I need pure HTML. And in CSS, specify which address to make the transition to.

<div>
<a class="button-click"></a>
</div>


.button-click a {href:"https://example.com"}

How do I specify a path in CSS?

  • 2
    you can't use CSS here but with js or jq you can handle it perfectly! – mkafiyan Jul 27 '20 at 11:47
  • 1
    Does this answer your question? [Changing the href of an html tag with css](https://stackoverflow.com/questions/15356717/changing-the-href-of-an-html-tag-with-css) – ventiseis Jul 27 '20 at 20:11

1 Answers1

2

CSS cannot be used to perform action or make changes to DOM. Its used for presentation purpose. You can use script to do the manipulation not css.

Tejeshree
  • 942
  • 6
  • 9
  • Clear. Very sorry. Tell me, what script should I write? –  Jul 28 '20 at 13:08
  • check this: https://stackoverflow.com/questions/4365246/how-to-change-href-of-a-tag-on-button-click-through-javascript/4365272#4365272 – Tejeshree Jul 28 '20 at 14:30
  • I apologize in advance for my ignorance in the code))The option that you offered me-I think it suits me. But I can't understand why there are two links? And each one has its own ID. Could you show me how to do this with my example? Thank you in advance. –  Jul 31 '20 at 07:10