CSS 将字体设置为“强”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14015786/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 21:06:50  来源:igfitidea点击:

CSS set font to "strong"

css

提问by Joshua

I need to set the font to "strong", but can't work out how to do this with CSS? I tried

我需要将字体设置为“强”,但不知道如何使用 CSS 来做到这一点?我试过

font-weight: 'Strong';

And I also tried it without the marks and it didn't work either. I'd like to set it to strong and not just bold as I've heard it helps disabled people while they are browsing your website (but that may be rubbish?!)

我也试过没有标记,但也没有用。我想将它设置为强而不是粗体,因为我听说它可以在残疾人浏览您的网站时帮助他们(但这可能是垃圾?!)

回答by Lee Taylor

You probably mean:

你可能的意思是:

font-weight: bold;

回答by steveax

There is no strongweight, try bold(which is usually the default browser style for a <strong>element.

没有strong权重,试试bold(这通常是<strong>元素的默认浏览器样式。

more about font-weightat MDN

更多关于font-weightMDN

回答by Callat

I just solved this exact problem based off the post I read here. Bold is not what you want as bold is not the equivalent of strong.

我刚刚根据我在这里阅读的帖子解决了这个确切的问题。大胆不是你想要的,因为大胆并不等同于强大。

For me using a polymer custom component.

对我来说使用聚合物自定义组件。

Strong = font-weight: 400

强 = font-weight: 400

Bold starts at font-weight: 500or greater.

粗体开始于font-weight: 500或更大。

Looking into it a bit further reveals that this is dependant on browser version and display and sometimes things don't get rendered how you want.

进一步研究它会发现这取决于浏览器版本和显示,有时事情不会按照你想要的方式呈现。

More details can be found at the MDN link posted above by steveax and Ryan

可以在 steveax 和 Ryan 在上面发布的 MDN 链接中找到更多详细信息

回答by Ry-

boldis the only way. You're confusing the accessibility aspect with the HTML tags<b>and <strong>, which have a bold style by default.

bold是唯一的方法。您将可访问性方面与HTML 标记<b>和混淆<strong>,默认情况下它们具有粗体样式。

<b>versus <strong>has less to do with accessibility, too, and more to do with semantics and the separation of styles from content. After all, you can style all <b>tags to be non-bold, and that's just confusing.

<b>vs<strong>也与可访问性无关,而更多地与语义和样式与内容的分离有关。毕竟,您可以将所有<b>标签的样式设置为非粗体,这只是令人困惑。

回答by eliseobeltran

font-weight:bold; is the equivalent of 'strong' font. You can also try

字体粗细:粗体;相当于“强”字体。你也可以试试

font-weight:900; (using numeric values).

字体粗细:900;(使用数值)。

回答by JimmyRare

strong is a html tag. css is for visual.

strong 是一个 html 标签。css是用于视觉的。