css font-weight属性怎样用?
font-weight属性设置文本的粗细。
语法:
font-weight:normal|bold|bolder|lighter|数值|inherit;
属性值:
● normal:默认值。定义规范的字符。
● bold:定义粗体字符。
● bolder:定义更粗的字符。
● lighter:定义更细的字符。
● 数值:定义由粗到细的字符,能够设置的数值有:100、200、300、400、500、600、700、800、900。个中400 等同于 normal,而 700 等同于 bold。
● inherit:划定应当从父元素继续字体的粗细。
申明:该属性用于设置显现元素的文本中所用的字体加粗。数字值 400 相当于 关键字 normal,700 等价于 bold。每一个数字值对应的字体加粗必需最少与下一个最小数字一样细,而且最少与下一个最大数字一样粗。
解释:一切主流浏览器都支撑 font-weight 属性。
css font-weight属性 示例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> p.normal {font-weight:normal;} p.light {font-weight:lighter;} p.thick {font-weight:bold;} p.thicker {font-weight:900;} </style> </head> <body> <p class="normal">This is a paragraph.</p> <p class="light">This is a paragraph.</p> <p class="thick">This is a paragraph.</p> <p class="thicker">This is a paragraph.</p> </body> </html>
效果图:
以上就是css font-weight属性怎样用的细致内容,更多请关注ki4网别的相干文章!