css - 无法使用CSS更改按钮高度

标签 css

<分区>


想改进这个问题吗? 通过 editing this post 添加细节并澄清问题.

关闭 9 年前

无法增加按钮的高度。它在计算样式中默认显示 18px。 更改宽度可以正常工作。我应用了 margin-left 和 top 的所有其他样式也可以,但为什么不能使用 Height??

   <input name="cancel" id="cancel" type="button" value="Cancel">

CSS

input#cancel {
   margin-top: 30px;
   margin-left: 48px;
   width: 70px;
   height: 24px!important;
}

我也试过这样在id中给出高度

   #cancel {
       height:24px;
   }

如果您需要在浏览器中显示的计算样式,请告诉我。请帮忙

最佳答案

您需要将 -webkit-appearance: none; 添加到您的类中以禁用 safari 的默认按钮样式

<input name="cancel" id="cancel" type="button" value="Cancel">
input#cancel { 
    margin-top: 30px; 
    margin-left: 48px; 
    width: 70px; 
    height: 42px; 
    -webkit-appearance: none;
}

看到这个 FIDDLE

关于css - 无法使用CSS更改按钮高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18004143/

上一篇:html - CSS 样式在移动浏览器上隐藏文本

下一篇:html - 当 Bootstrap Modal 打开时,滚动条会改变方向

相关文章:

html - CSS 包装文本和数字之间的差异

javascript - slideToggle 整个 div

html - 单击超链接后如何更改超链接的颜色

javascript - Vanilla JS 从除 'active' 类之外的所有其他元素中删除类

html - 为什么我的导航列表是颠倒的?

html - float DIV 和高度

html - SVG tspan 元素 + 字体系列样式?

html - 在文本溢出到下一行后,防止文本包装器跨越其父级的整个宽度

forms - CSS - 无法让两个表单域水平并排放置

Android 忽略 maxWidth