css中文字的粗细怎样设置?在实际的项目中,我们常会需要设置文字的粗细,例如字体加粗突显内容。HTML中通过添加<b>标记,或者<strong>标记来设置文字的粗细。那么CSS中要怎样实现呢?
CSS可以将文字的粗细进行了细致的划分,而且,还可以将本身是粗体的文字,变为正常的粗细显示。
<html> <head> <title>文字粗细</title> <style> h1 span { font-weight: lighter; } span { font-size: 30px; } span.one { font-weight: 100; } span.two { font-weight: 200; } span.three { 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属性设置,就可以实现我们想要的效果,需要的朋友可以参考上述代码,希望本文能对大家有帮助,想要了解更多请关注群英网络其它相关文章。
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2018 群英 版权所有 茂名市群英网络有限公司
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号-36 粤公网安备 44090202000006号 粤工商备P091701000595