如何使用十进制值设置 CSS RGB 颜色?

RBT*_*RBT 2 html css colors

我是 HTML/CSS 的新手。我可以看到有多种方法可以在 CSS 样式描述中设置颜色代码,即通过名称yellow或十六进制代码#ffff00。我看到每种颜色也有十进制等效值,例如黄色具有十进制等效值,255,255,0但是在我的 body 元素上应用以下样式根本没有效果:

我的CSS:

body {
background-color: 255,255,0;
color: black !important;
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮我吗?

Car*_*lla 6

像这样

body {
    background-color: rgb(255,255,0);
}
Run Code Online (Sandbox Code Playgroud)

要添加不透明度,请使用rgba. 哪里1是 100% 不透明度。

body {
    background-color: rgba(255,255,0, 1);
}
Run Code Online (Sandbox Code Playgroud)