首页 > 解决方案 > HTML:如何更改按钮的大小,使其与上面的图标大小相同?

问题描述

我在https://www.css3buttongenerator.com的帮助下创建了一个按钮。我现在正在尝试调整我的 html 上的按钮大小,以便按钮上的图标完全适合它。可以这么说,我希望它们的尺寸相同。但那个网页并没有真正帮助我。

这就是我的代码的样子。 HTML:

<button class="butn"><i class="fa fa-question-circle-o" id="AnzeigeerstellenHilfe"></i></button>

CSS:

.butn {
  color: #859f38;
    background-color:transparent;
     background-size: 30px !important;
    width: 22px !important;
    height: 22px !important;
  text-decoration: none;
    border: none;
     outline: 0 !important;
}

我一直在玩 .css 上的值并更改/添加东西,但到目前为止没有成功。我该怎么做?

标签: htmlcssclassbuttonstyles

解决方案


尝试:

<button class="butn"><i class="fa fa-question-circle-o" id="AnzeigeerstellenHilfe"></i></button>

.butn {
   color: #859f38;
   background-color:transparent;
   text-decoration: none;
   border: none;
   outline: 0 !important;
}

或者如果您想调整图标大小,请使用@sao 的答案


推荐阅读