当前位置:首页 > 千层云服务器 > 正文

css如何设置字体颜色

在css中设置字体颜色的方法:1.创建p标签;2.使用color属性设置字体颜色;

css如何设置字体颜色

在css中设置字体颜色的方法

1.首先,在页面中创建两个p标签,并添加文字用于对比;

<!DOCTYPEhtml>

<html>

<head>

<metacharset="utf-8"/>

<style></style>

</head>

<body>

<pclass="btn">红色字体</p>

<pclass="nav">蓝色字体</p>

</body>

</html>

2.p标签创建好后,使用color属性即可设置字体的颜色;

<!DOCTYPEhtml>

<html>

<head>

<metacharset="utf-8"/>

<style>

.btn{

color:red;

}

.nav{

color:blue;

}

</style>

</head>

<body>

<pclass="btn">红色字体</p>

<pclass="nav">蓝色字体</p>

</body>

</html>

效果:

css如何设置字体颜色


如果您对该产品感兴趣,请填写办理(客服微信:xiaoxiongyidong)

为您推荐:

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

在线客服