1. CSS 속성을 정의하는 W3C에서 제공하므로 가장 정확하다
%
부모의 값에 대해서 백분율로 환산한 크기를 갖게 됩니다.
em
font-size를 기준으로 값을 환산합니다. 소수점 3자리까지 표현 가능합니다.
rem
root의 font-size를 기준으로 값을 환산합니다.
vw
viewport의 width값을 기준으로 1%의 값으로 계산됩니다.
h1 { color: 색상 값; }
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>color</title>
</head>
<body>
<h1 style="color: red"> heading </h1>
<h1 style="color: #ff0000"> heading </h1>
<h1 style="color: #f00"> heading </h1>
<h1 style="color: rgb(255,0,0)"> heading </h1>
<h1 style="color: rgba(255,0,0, 0.5)"> heading </h1>
</body>
</html>
background: [-color] [-image] [-repeat] [-attachment] [-position];
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>background</title>
<style>
div {
height: 500px;
background-color: yellow;
background-image: url(https://www.w3schools.com/CSSref/img_tree.gif);
background-repeat: no-repeat;
background-position: center top;
/* 축약형 */
background: yellow url(https://www.w3schools.com/CSSref/img_tree.gif) no-repeat center top;
}
</style>
</head>
<body>
<div> css background 속성 실습 </div>
</body>
</html>