![]() |
Combining the a href + button tag? Would it cause any problems in the website or any browers? <a href="whatever.html'><button>text in here</button></a> Is there a better alternative? Thanks. |
RE: Combining the a href + button tag? Thanks, Brother |
Re: Combining the a href + button tag? Quote:
|
Re: Combining the a href + button tag? To be honest, I am a big fan of bootstrap. Using bootstrap you can just apply a button style to an anchor link and get the desired visual effect of a button. To do this without using booststrap, you should remove the button code, and just use css to style the link to look like a button. For a more advanced method, use javascript for the linking. https://codepen.io/svinkle/pen/FHGBh |
RE: Combining the a href + button tag? No, it isn't valid HTML5 according to the HTML5 Spec Document from W3C: In other words, you can nest any elements inside an <a> except the following: Code: <a>If you are trying to have a button that links to somewhere, wrap that button inside a <form> tag as such: Code: <form style="display: inline" action="http://example.com/" method="get"> |
Re: Combining the a href + button tag? Quote:
https://superdevresources.com/super-...st-button-css/ |
Re: Combining the a href + button tag? <a class="button" href="#">This is Button</a> <style> .button{ padding:5px; background:black; color:white; border-radius:5px; } a{ text-decoration:none; } </style> |
RE: Combining the a href + button tag? There is no alternate tag for <a> in HTML. But you can create it's alternative using JavaScript. It is way less efficient than <a> tag. But if you still want to do it, follow me. HTML: <body> <p class="para"> <span id="redirect"> </span> </p> CSS: .para { font-family: sans-serif; color: #F00; font-size: 127%; text-decoration: none; } #redirect { font-family: inherit; color: #0F0; text-decoration: underline; } JavaScript: document.getElementById("redirect").onclick(redire ct()); function redirect() { window.location.href="whatever.html"; //May load a cached page }; |
Re: Combining the a href + button tag? Quote:
|
RE: Combining the a href + button tag? Add "display:block;" to "button" class, then whole button will be clickable. |
RE: Combining the a href + button tag? <input type="button" class="btn btn-info" value="Input Button" onclick=" relocate_home()"> <script> function relocate_home() { location.href = "www.yoursite.com"; } </script> |
| All times are GMT -6. The time now is 02:34 AM. |