To make a hyperlink that works like a button, you can wrap the hyperlink in an
<a> tag with the button type attribute. The button type attribute tells the browser to render the hyperlink as a button.
The following code shows how to make a hyperlink that works like a button:
In this code, the <a> tag has the href attribute set to the URL of Google and the
type attribute set to button. This will render the hyperlink as a button that, when clicked, will navigate to the Google website.
You can also style the button using CSS. The following CSS code shows how to style the button to have a blue background and white text:
In this code, the a.button selector is used to select all hyperlinks with the
button type attribute. The background-color property is set to blue, the
color property is set to white, the padding property is set to 10px 20px, and the
border-radius property is set to 5px.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
To make a hyperlink that works like a button, you can wrap the hyperlink in an
<a>tag with thebuttontype attribute. Thebuttontype attribute tells the browser to render the hyperlink as a button.The following code shows how to make a hyperlink that works like a button:
HTML
In this code, the
<a>tag has thehrefattribute set to the URL of Google and thetypeattribute set tobutton. This will render the hyperlink as a button that, when clicked, will navigate to the Google website.You can also style the button using CSS. The following CSS code shows how to style the button to have a blue background and white text:
CSS
In this code, the
a.buttonselector is used to select all hyperlinks with thebuttontype attribute. Thebackground-colorproperty is set to blue, thecolorproperty is set to white, thepaddingproperty is set to 10px 20px, and theborder-radiusproperty is set to 5px.