
字体加粗
font-weight 属性设置文本的粗细。
使用 bold 关键字可以将文本设置为粗体。 ( 推荐学习:CSS基础教程 )
关键字 100 ~ 900 为字体指定了 9 级加粗度。如果一个字体内置了这些加粗级别,那么这些数字就直接映射到预定义的级别,100 对应最细的字体变形,900 对应最粗的字体变形。数字 400 等价于 normal,而 700 等价于 bold。
如果将元素的加粗设置为 bolder,浏览器会设置比所继承值更粗的一个字体加粗。与此相反,关键词 lighter 会导致浏览器将加粗度下移而不是上移。
实例
<html><head><style type="text/css">p.normal {font-weight: normal}p.thick {font-weight: bold}p.thicker {font-weight: 900}</style></head><body><p class="normal">This is a paragraph</p><p class="thick">This is a paragraph</p><p class="thicker">This is a paragraph</p></body></html>
以上就是在CSS中字体加粗要怎么做?的知识。速戳>>知识兔学习精品课!