Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

การกำหนดสีด้วยโมเดล HSL ใน CSS


เพื่อกำหนดสีด้วยโมเดล Hue-Saturation-Lightness (HSL) ให้ใช้เมธอด hsl() ใน CSS

คุณสามารถลองรันโค้ดต่อไปนี้เพื่อนำฟังก์ชัน hsl() ไปใช้ใน CSS ได้

ตัวอย่าง

<!DOCTYPE html> <html>    <head>       <style>          h1 {             background-color:hsl(0,100%,50%);          }          h2 {             background-color:hsl(192,89%,48%);          }       </style>    </head>    <body>       <h1>Red Background</h1>       <h2>Blue Background</h2>    </body> </html>