HTML 색상 표현 방법

HTML 문서에 색상 적용방법입니다.

Colors : CSS 색상, color, background-color
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Colors</title>
    <style>
        body {
            font: 100 1.5em Helvetica, Arial, sans-serif;
            color: white;
            background-color: black;
        }
    
        #p1 {
            color: #f83333;
            background-color: #444; /* 16진수 색상 값 */
        }
        #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); /* 오류! 정수와 백분율 혼용 금지 */
        }
    </style>
</head>
<body>

    <h1>Colors</h1>
    <p>This page's body is set to color: white; background-color: black;</p>

    <p id="p1">This paragraph is set to color: #f83333; background-color: #444;</p>

    <p id="p2">This paragraph is set to color: rgb(0,127,255); background-color: rgba(0%,50%,50%,0.5);</p>

    <p id="p3">This paragraph is set to color: hsl(240,100%,75%); background-color: hsla(0,0%,100%,0.2);</p>

</body>
</html>

you're currently offline