首页 > 解决方案 > 我可以设置字体粗细吗

问题描述

我需要使用标签或 .h5 引导类来增加字体大小,但我不希望文本加粗。

<p class="h5 font-weight-light">Whatever</p>

<h5 class="font-weight-light">Whatever</h5>

<h5 style="font-weight: 300">Whatever</h5>

对我不起作用。他们都很大胆。

你知道如何让它工作吗?

标签: htmlcsstwitter-bootstrap

解决方案


您缺少 !important 使该样式处于活动状态,因此:

<h5 style="font-weight:300 !important;">Whatever</h5> 

最好将该 CSS 放在一个单独的文件中,而不是直接放在 html 中。

直接设置字体大小就不需要h5了。

style { font-size: 2rem ; }

推荐阅读