繁体   English   中英

firefox 按钮删除 firefox 77 中的填充

[英]firefox button remove padding in firefox 77

我尝试使用在 stackoverflow 上找到的解决方案来执行此操作,但它似乎不适用于较新版本的 firefox。 我希望红色背景占据整个按钮,但这仅适用于 chrome,不适用于 firefox。 我添加了应该解决此问题的button::-moz-focus-inner css 规则。 有谁知道如何在较新版本的 firefox 中执行此操作?

<style>

button {
    padding: 0px;
}

label {
    display: block;
    padding: 1px 6px;
    background-color: red;
}

button::-moz-focus-inner {
    padding: 0;
    border: 0;
}
</style>

<button>
    <label for="myId">My Button</label>
</button>

<br />

<button>My Button</button>

<input id="myId" type="checkbox" />

您已将 label 放入按钮中,并将红色背景应用于 label,而不是按钮。 最好不要使用 label 标签,但如果需要,请将按钮放在 label 标签中。

 <style> button { /* Padding is pretty important for buttons */ padding: 3px 5px; border: 0; background-color: red; cursor: pointer; margin: 0px; } </style> <button>My Button</button> <!-- It is good practice to put labels right before what they are labeling --> <label for="myId"><button>My Button</button></label> <input id="myId" type="checkbox" />

我可能是错的,无论如何我都不想变得粗鲁。 但看起来你对 web 开发人员很陌生。 W3Schools上查找您遇到问题的任何 css 属性或标签。 这是一个很棒的网站。 干杯,艾萨克。

暂无
暂无

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

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