要使用“色相-饱和度-亮度”模型(HSL)定义颜色,请使用hsla()CSS方法。
您可以尝试运行以下代码以hsla()在CSS中实现该功能
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
background-color:hsl(0,100%,50%);
}
h2 {
background-color:hsl(192,89%,48%);
}
p {
background-color:hsla(290,100%,50%,0.3);
}
</style>
</head>
<body>
<h1>Red Background</h1>
<h2>Blue Background</h2>
<p>This is demo text!</p>
</body>
</html>