2.CSS文字颜色定义,背景色定义

本文介绍了如何使用CSS定义网页的文字颜色及背景颜色。通过简单的HTML示例,展示了如何将颜色属性应用于文本和页面背景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

color就代表颜色,我们使用红色 red 为文字颜色.

你可以修改代码使用 blue 蓝色, yellow 黄色等.学习文字的颜色


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>定义文字的颜色</title>
<style type="text/css" media="all">

{
color:red;
}
</style>
</head>
<body>
<p>你可以修改代码使用 blue 蓝色, yellow 黄色等.学习<a href="http://www.dreamdu.com/css/property_color/">文字的颜色</a></p>


</body>
</html>


background-color就代表网页的背景颜色,我们使用黄色 yellow 为网页背景.

你可以修改代码使用 red 红色, blue 蓝色等.学习网页背景颜色.

ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>定义网页的背景颜色</title>
<style type="text/css" media="all">
body 
{
background-color:yellow;
}
</style>
</head>
<body>
<p>你可以修改代码使用 red 红色, blue 蓝色等.学习<a href="http://www.dreamdu.com/css/property_background/">网页背景颜色</a>.</p>


</body>
</html>




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值