本教程操作环境:windows7系统、css3&&html5版、dell g3电脑。
在css文件中,字体加粗属性为“font-weight”。
font-weight 属性可设置文本的粗细,支持多种属性值:
值描述
normal 默认值。定义标准的字符。
bold 定义粗体字符。
bolder 定义更粗的字符。
lighter 定义更细的字符。
100200300400500600700800900 定义由细到粗的字符。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>
(学习视频分享:css视频教程)
以上就是在css文件中字体加粗属性为什么的详细内容。
