CSS 无法将输入提交按钮上的文本样式设置为粗体?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21664610/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't style text on input submit button as bold?
提问by flossfan
I'm trying to style the font in an input button as bold.
我正在尝试将输入按钮中的字体设置为粗体。
Here's my code:
这是我的代码:
<input type="submit" id="nm-match" class="nm-button" value="Match" />
Here's my CSS:
这是我的 CSS:
.nm-button {
text-transform: uppercase;
padding: 5px;
color: blue;
font-weight: bold;
}
All the styles are being applied apart from the bold.
除了粗体之外,所有样式都被应用。
Here's a JSFiddle showing the problem: http://jsfiddle.net/CJg43/1/
这是一个显示问题的 JSFiddle:http: //jsfiddle.net/CJg43/1/
UPDATE: Why the close votes? Here's a screenshot of how it looks for me, in Chrome on MacOS:
更新:为什么接近投票?这是它在 MacOS 上的 Chrome 中的外观截图:
UPDATE 2: ... and for comparison, here's how it looks with the solution (background-color: white
) applied - http://jsfiddle.net/CJg43/23/
更新 2:...为了进行比较,这里是background-color: white
应用解决方案 ( ) 的情况 - http://jsfiddle.net/CJg43/23/
采纳答案by pschueller
Are you using chrome for a MacOS? If so, try adding a background-color to the button to see if it fixes it. The default Aqua styles might be interfering. You can also try -webkit-appearance: none;
or -webkit-appearance: button;
.
你在 MacOS 上使用 chrome 吗?如果是这样,请尝试为按钮添加背景颜色以查看它是否修复了它。默认的 Aqua 样式可能会产生干扰。您也可以尝试-webkit-appearance: none;
或-webkit-appearance: button;
。
回答by Sachin
When you use numeric values with the font-weight
property and you want to use bold
then use the value greater than or equal to 700
当您在font-weight
属性中使用数值并且想要使用时,请bold
使用大于或等于的值700
.nm-button {
text-transform: uppercase;
padding: 5px;
color: blue;
font-weight: 700;
}