简体   繁体   中英

How do I make the entire button clickable?

I've tried to put dispay:block or also dispay:inline-block but nothing seems to change.
Here is the css code of my buttons:

button {
  width: 120px;
  height: 60px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  font color: black;
  margin: 4px 2px;
  transition-duration: 0.4s;
  cursor: pointer;
  background-color: white; 
  color: black; 
  border: 2px solid #CC0000;
}

Next time give here also HTML. From what you said, you have button and an "a" tag inside

switch order of tags to:

<a href='url'><button>Text</button></a>

or you can simply style element as button

<a href='url' class='button'>text</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM