在css中,可以使用 font-weight 属性 改变 字体粗细,只需要给字体元素设置“font-w ei ght:数值;”。该属性用于设置显示元素的文本中所用的字体 加粗 。数字值400相当于关键字normal,700等价于bold。
本教程操作环境:windows7系统、CSS3 && HT ML 5版、Dell G3 电 脑。
HTML中通过添加<b>标记, 或者 < strong >标记来设置文字的粗细。
CSS可以将文字的粗细进行了细致的划分,而且,还可以将本身是 粗体 的文字,变为 正常 的粗细显示。
<html> <head> <t IT le>文字粗细</title> <style> h1 span { font-weight: lighter; } span { font- Size: 30px; } span.one { font-weight: 100; } span.two { font-weight: 200; } span.t hr ee { font-weight: 300; } span.four { font-weight: 400; } span.five { font-weight: 500; } span.sex { font-weight: 600; } span.seven { font-weight: 700; } span.eight { font-weight: 800; } span.nine { font-weight: 900; } span.ten { font-weight: bold; } span.eleven { font-weight: normal; } </style> </head> <body> <h1>文字<span>粗</span>体</h1> <span class="one">文字粗细:100</span> <span class="two">文字粗细:200</span> <span class="three">文字粗细:300</span> <span class="four">文字粗细:400</span> <span class="five">文字粗细:500</span> <span class="six">文字粗细:600</span> <span class="seven">文字粗细:700</span> <span class="eight">文字粗细:800</span> <span class="nine">文字粗细:900</span> <span class="ten">文字粗细:bold</span> <span class="eleven">文字粗细:normal</span> </body> </html>
文字的粗细在CSS中通过属性:font-weight设置,如上代码几乎涵盖了所有的文字粗细值,并且,可以是本身是粗体的字体,变成正常粗体。
推荐学习:css视频教程
以上就是css如何改变字体粗细的详细内容,更多请关注其它相关 文章 !
总结
以上是 为你收集整理的 css如何改变字体粗细 全部内容,希望文章能够帮你解决 css如何改变字体粗细 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did200096