如何在DW中如何改变CSS中的字体大小和颜色?

html-css014

如何在DW中如何改变CSS中的字体大小和颜色?,第1张

font:粗细

大小/行高

字体

color:颜色

比如要控制td内的宋体加粗红色文字:

td{

font:bold

16px/100%

'宋体'

color:red

}

font:粗细

大小/行高

字体

color:颜色

比如要控制td内的宋体加粗红色文字:

td{

font-size:16px

line-height:100%

font-weight:bold

font-family:'宋体'

color:red

}

需要准备的材料分别有:电脑、浏览器、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 加粗使用CSS属性单词font-weight:

例子:

.yangshi1{ font-weight:bold}

.yangshi2{ font-weight:600}

font-weight对象值:从100到900,最常用font-weight的值为bold

font-weight参数:

normal : 正常的字体。相当于number为400。声明此值将取消之前任何设置

bold : 粗体。相当于number为700。也相当于b对象的作用

bolder : IE5+ 特粗体

lighter : IE5+ 细体

number : IE5+ 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900