CSS 中给字体加粗可以通过 font-weight 属性,默认值 nORMal,加粗值 bold,还支持更轻(lighter)、更重(bolder)、100-900 数值(400 为正
CSS 中给字体加粗可以通过 font-weight 属性,默认值 nORMal,加粗值 bold,还支持更轻(lighter)、更重(bolder)、100-900 数值(400 为正常)。
在 CSS 中给字体加粗
在 CSS 中给字体加粗非常简单,可以使用 font-weight
属性。
HTML 代码
<code class="html"><p>这是普通文本</p>
<p><strong>这是加粗文本</strong></p></code>
CSS 代码
<code class="<a style='color:#f60; text-decoration:underline;' href=" https: target="_blank">css">p {
font-weight: normal;
}
strong {
font-weight: bold;
}</code>
在这个示例中,normal
是字体的默认权重,而 bold
是加粗权重。
除了 normal
和 bold
之外,font-weight
属性还支持以下值:
示例
要将文本加粗为中等粗细,可以使用以下 CSS:
<code class="css">p {
font-weight: 600;
}</code>
浏览器支持
font-weight
属性得到所有现代浏览器的良好支持。
以上就是css中怎么给字体加粗的详细内容,更多请关注编程网其它相关文章!
--结束END--
本文标题: css中怎么给字体加粗
本文链接: https://www.lsjlt.com/news/609018.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-04
2024-05-04
2024-05-04
2024-05-04
2024-05-04
2024-05-04
2024-05-04
2024-05-04
2024-05-04
2024-05-04
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0