Put link inside the button

Asked

Viewed 69 times

1

I’m sorry to ask, it’s a very simple question, but I don’t know how to solve.

The tag creates the button but when I click on the button it just doesn’t do anything. It doesn’t take me to the link, it continues on the same page.

<a href="home.html"><button>Home</button></a>

  • But why do you need a button within a link?

  • would be one of the menu option for redirecting. for example a home boot, another for cataloging and so on

  • So these are links themselves. The button there will be unnecessary. You put it because you want to keep the appearance of the button?

  • Felipe da uma lida aqui: https://www.htmlprogressive.net/2013/06/O-que-e-um-link-em-HTML-para-que-serve-e-como-usar.html

  • I want to put because of the appearance of the boot, I can simulate this appearance using css?

  • You can style like a button yes, the problem is that Each user-agent of each browser has its default CSS for the button. You have to be clearer in what you really need. Or at least indicate an example that you want to get

  • Another thing. I tested your btn here and it works, your link problem not being going to page is another... just vc test there <a href="https://google.com"><button>Home</button></a> that you will see that goes to Google page

Show 2 more comments

1 answer

2

Example of a button created with the widget A using a Bootstrap CSS adaptation.

Customize as you wish by changing CSS statements:

.btn {
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  background-color: #000;
  display: inline-block;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  border: 3px solid #999;
  padding: .375rem .75rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: .25rem;
  transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.btn:hover {    
  background-color: #999;
  border-color: #000; 
}
<a href="#" class="btn">BOTAO</a>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.