CSS를 사용하여 요소의 텍스트, 테두리 및 배경에 대한 색상을 정의할 수 있습니다. color 속성은 요소의 텍스트 색상을 지정하는 데 사용됩니다.
구문
CSS 색상 속성의 구문은 다음과 같습니다. -
Selector {
color: /*value*/
} 다음 예는 CSS 색상 속성을 보여줍니다 -
예시
<!DOCTYPE html>
<html>
<head>
<style>
div {
color: seashell;
background-color: lightcoral;
}
p {
font-size: 1.5em;
color: blue;
background-color: palegreen;
box-shadow: 0 0 5px 1px rgb(0,0,0);
}
</style>
</head>
<body>
<div>
This is demo text.
<p>
Text added for reference.
</p>
This is demo text 2.
</div>
</body>
</html> 출력
이것은 다음과 같은 출력을 제공합니다 -

예시
<!DOCTYPE html>
<html>
<head>
<style>
* {
text-align: center;
}
h3 {
color: red;
border: 2px ridge rosybrown;
}
p {
color: royalblue;
background-color: cornsilk;
box-shadow: 0 0 5px 1px deeppink;
}
</style>
</head>
<body>
<h3>Demo Demo Demo Demo</h3>
<p>Demo text here</p>
</body>
</html> 출력
이것은 다음과 같은 출력을 제공합니다 -
