CSS颜色,使用color和background-color属性。

body {
			font: 100 1.5em Helvetica, Arial, sans-serif;
			color: white;
			background-color: black;
		}
	
		#p1 {
			color: #f83333;
			background-color: #444;
		}
		#p2 {
			color: rgb(0,255,127);
			background-color: rgba(50%,50%,0%,0.5);
		}
		#p3 {
			color: hsl(240,100%,75%);
			background-color:  hsla(0,0%,100%,0.2);
		}

实际效果:

body背景

本段设置为颜色:#f83333; 背景颜色:#444;

本段设置为颜色:rgb(0,127,255); 背景颜色:rgba(0%,50%,50%,0.5);

本段设置为颜色:hsl(240,100%,75%); background-color:hsla(0,0%,100%,0.2)

🏆 每日挑战:你知道答案吗?

什么是 CSS 的 `pointer-events` 属性?

温馨提示 : 非特殊注明,否则均为©李联华的博客网原创文章,本站文章未经授权禁止任何形式转载;IP地址:18.97.9.168,归属地:弗吉尼亚州Ashburn ,欢迎您的访问!
文章链接:https://www.lilianhua.com/css-color-using-the-color-and-background-color-attributes.html

文澜千文文澜千文Beta

请登录以使用此功能。

弹窗图片

年终回馈! 200积分免费领取,可通过用户中心或VIP会员页面通过兑换码进行兑换:OAK-8909956

Loading...