网站样式css加粗代码是什么
2022-11-18 09:21:57
149
{{single.collect_count}}

网站样式css加粗代码是“文字元素{font-weight: bold;}”或“文字元素{font-weight: bolder;}”。font-weight属性用于设置文本的粗细,当该属性的值设置为“bold”时可定义粗体字符,设置为“bolder”时可定义更粗的字符;font-weight属性的值也可设置为数值“700”、“800”或“900”,这样也可实现文字加粗效果。

前端(vue)入门到精通课程:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

网站样式css加粗代码:

文字元素{font-weight: bold;}文字元素{font-weight: bolder;}
登录后复制

用到的CSS属性为:字体加粗属性“font-weight”。

font-weight 属性可设置文本的粗细,支持多种属性值:

描述
normal默认值。定义标准的字符,等于400。
bold定义粗体字符,等于700。
bolder定义更粗的字符。
lighter定义更细的字符。
  • 100
  • 200
  • 300
  • 400
  • 500
  • 600
  • 700
  • 800
  • 900
定义由细到粗的字符。400 等同于 normal,而 700 等同于 bold。

示例:四段文字设置不同的字体粗细

<!DOCTYPE html><html><head><meta charset="utf-8"><title>css 文字加粗</title><style>p.normal {font-weight: normal;}p.bold {font-weight: bold;}p.bolder {font-weight: bolder;}p.thicker {font-weight: 900;}</style></head><body><p class="normal">测试文本!</p><p class="bold">测试文本!</p><p class="bolder">测试文本!</p><p class="thicker">测试文本!</p></body></html>
登录后复制

1.png

说明:strong、b、h1~h6等标签的font-weight默认就是bold

(学习视频分享:css视频教程

以上就是网站样式css加粗代码是什么的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}