Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why href inside button not working?

<button class="button button-outline button-positive">
    <a href="www.google.com">fes</a>
</button>

If I use ng-click, it's works fine, but I need href.

like image 311
GO VEGAN Avatar asked Mar 24 '15 09:03

GO VEGAN


People also ask

Does href work on button?

The only difference is that the <button> element allows children. You'd intuitively expect to be able to use <button href="https://google.com"> analogous with the <a> element, but unfortunately no, this attribute does not exist according to HTML specification.

Can you have a button inside a link?

It is illegal in HTML5 to embed a button element inside a link. To whom it may concern.

Can I use a tag inside button?

Inside a <button> element you can put text (and tags like <i> , <b> , <strong> , <br> , <img> , etc.). That is not possible with a button created with the <input> element! Tip: Always specify the type attribute for a <button> element, to tell browsers what type of button it is.


1 Answers

Drop the button and decorate the a element with the class names.

<a href="www.google.com" class="button button-outline button-positive">fes</a>

hope this helps.

like image 102
shakib Avatar answered Sep 20 '22 17:09

shakib