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>
To link specifically to a file, you can also use the tag mentioned above, but with a relative URL instead of an absolute URL (also known as not including "https://www.").
For example, if you place files in an internal directory outside of the base directory, you can use the following snippet:
More information about this here.
Using the
onclick
element: