Home  >  Q&A  >  body text

How to add hyperlink functionality using html and css

I have some HTML code that contains some css and I want the button to actually serve a purpose like a hyperlink, I press it and it takes me to a certain file or url, I have tried inside the field Using actual hyperlinks but it looks ugly and only the hyperlink can be pressed, I tried adding an HTML default hyperlink button but it cannot be colored.

code show as below:

<html>
<body style="background-color:rgb(48, 45, 45)">
<font color="white">
<font color="#4CAF50">
<head>
<style>
.button {
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button1 {background-color: #4CAF50;}
.button2 {background-color: #008CBA;}
</style>
</head>
<body>
<button class="button button1">Green</button>
<button class="button button2">Blue</button>
</body>

P粉596191963P粉596191963182 days ago351

reply all(2)I'll reply

  • P粉949267121
  • P粉035600555

    P粉0356005552024-04-02 17:54:27

    Using the onclick element:

         
        sssccc

    reply
    0
  • Cancelreply