用CSS如何让列表字体变粗?

html-css023

用CSS如何让列表字体变粗?,第1张

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<script>标签中,输入js代码:

$('td').click(function () {

$('td').css('font-weight', 'normal')

$(this).css('font-weight', 'bold')

})

3、浏览器运行index.html页面,点击“我是A”,此时字体会变粗。

4、再点击“我是B”,此时“我是A”的字体粗度恢复正常,“我是B”的字体变粗。

CSS字体加粗的方法:

font-weight 属性设置文本的粗细。使用 bold 关键字可以将文本设置为粗体。

例如:

html:

<p>字体加粗</p>

css:

p{

font-weight:blod

}

css中font样式常用的使用方法:

font-style:规定字体样式

font-weight:规定字体粗细

font-family:规定字体系列

两种方法给字体加粗,一种就是直接用<b>标签,例如 : <b>粗</b>

或者用css添加样式  <div style="font-weight: bold">加粗 </div>

可以用的值有下面这些。400 等同于 normal,而 700 等同于 bold。

normal   默认值

bold   定义粗体字符

bolder   定义更粗的字符

lighter   定义更细的字符

100

200

300

400

500

600

700

800

900