广告:宝塔Linux面板高效运维的服务器管理软件 点击【 https://www.bt.cn/p/uNLv1L 】立即购买
css中可利用font-weight属性来让元素不加粗,写法为“元素{font-weight:normal;}”;font-weight属性用于设置文本的粗细样式,当值设置为“normal”时,元素会被设成标准字符样式,也就是不加粗的样式。
本教程操作环境:windows10系统、CSS3&&HTML5版、Dell G3电脑。
css中不加粗怎么写
在css中可以利用font-weight属性来给元素设置不加粗的样式,font-weight属性用于设置文本的粗细。
属性值如下图所示:
下面我们通过示例来看一下怎样使元素不加粗,示例如下:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style type="text/css">p {font-weight: bold}</style></head><body><p class="normal">这一段不想加粗</p><p>This is a paragraph</p><p>This is a paragraph</p></body></html>登录后复制
输出结果:
此时并不想让其中一段话加粗,只需要给这段话添加font-weight: normal样式即可:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style type="text/css">p {font-weight: bold}p.normal {font-weight: normal}</style></head><body><p class="normal">这一段不想加粗</p><p>This is a paragraph</p><p>This is a paragraph</p></body></html>登录后复制
输出结果:
(学习视频分享:css视频教程)
以上就是css中不加粗怎么写的详细内容,更多请关注9543建站博客其它相关文章!
发表评论