首页 > 编程开发 > CSS    日期:2021-01-27 / 来自互联网 / 浏览

详细介绍:

在CSS中,可以通过font-weight属性来设置字体的粗细。

属性值:

  • normal 默认值。定义标准的字符。

  • bold 定义粗体字符。

  • bolder 定义更粗的字符。

  • lighter 定义更细的字符。

html示例:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
.lighter {
font-weight: lighter;
}
.normal {
font-weight: normal;
}
.bold {
font-weight: bold;
}
.bolder {
font-weight: bolder;
}
   </style>
 </head>
  <body>
<p class="lighter">字体粗细:lighter</p>
<p class="normal">字体粗细:normal</p>
<p class="bold">字体粗细:bold</p>
<p class="bolder">字体粗细:bolder</p>
  </body>
</html>

运行结果:

css怎么让字体变细

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章

1 2 3 4 5