0

I am creating a button that will show a description when you hover over it. But I want go to a link once clicked, how do I add the link to the button since I have a hover:before {content:"New Text"}

    button {width:20em}
    button {height:5em}
    button {
      box-shadow:inset 34px 0px 0px -15px #88bd40;
      background-color:#000000 ;
      border:1px solid #ffffff;
      display:inline-block;
      cursor:pointer;
      color:#ffffff;
      font-family:Arial;
      font-size:15px;
      font-weight:bold;
      padding:9px 23px;
      text-decoration:none;
      text-shadow:0px -1px 0px #7a2a1d;

      }
     button:hover span {display:none}
     button:hover {
     background-color:#4c4c4c;}
     button:hover:before {content:"New Text"}
<html>
 <head>
 </head>
  <body>
   <button class="button"><span> Old text </span></button>
  </body>
</html>
Mazhar Khan
  • 302
  • 1
  • 12
gdiaz
  • 1
  • 1
  • So, you have done the hover text change but need to go to a specific link on click? – Mazhar Khan Oct 22 '19 at 18:18
  • Possible duplicate of [How to create an HTML button that acts like a link?](https://stackoverflow.com/questions/2906582/how-to-create-an-html-button-that-acts-like-a-link) – Sean Oct 22 '19 at 18:30

3 Answers3

1

Change the button to anchor tag and add an href to it e.g

<a href="https://www.google.com"><span> Old text </span></a>

I modified your code to what you want you can see the below link

Code Link: https://codepen.io/codergoldlie/pen/ZEEeYKW

Mazhar Khan
  • 302
  • 1
  • 12
0

I would rather suggest having a link styled like a button. This way you will have a hover effect, content change, and a link...

<a href="#your_link#" class="button">Old text</a>

0

You can add either href or attach a click event to button.

Rohit Kotak
  • 173
  • 1
  • 17