您的位置:首页 > Web前端 > CSS

CSS设置文字粗细

2016-07-18 15:55 501 查看
CSS设置文字粗细

          HTML中通过添加<b>标记,或者<strong>标记来设置文字的粗细。
          CSS可以将文字的粗细进行了细致的划分,而且,还可以将本身是粗体的文字,变为正常的粗细显示。

<span style="font-size:24px;"><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>
</span>


          文字的粗细在CSS中通过属性:font-weight设置,如上代码几乎涵盖了所有的文字粗细值,并且,可以是本身是粗体的字体,变成正常粗体。
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: