简体   繁体   English

如何使整个按钮可点击?

[英]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.我尝试放置dispay:blockdispay:inline-block但似乎没有任何改变。
Here is the css code of my buttons:这是我的按钮的 css 代码:

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.下次也给这里 HTML。 From what you said, you have button and an "a" tag inside根据您所说,您有按钮和里面的“a”标签

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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