둘의 차이는 background-color는 background의 color 요소만 지정이 가능하고
background 는 color외에 image, attach, repeat, position 등
다양한 백그라운 옵션을 지정해 줄 수 있다.
MDN에 나와 있는 구성요소
- background-attachment
- background-clip
- background-color
- background-image
- background-origin
- background-position (en-US)
- background-repeat
- background-size
MDN에 나와 있는 사용예제
/* <background-color> 사용 */
background: green;
/* <bg-image>와 <repeat-style> 사용 */
background: url("test.jpg") repeat-y;
/* <box>와 <background-color> 사용 */
background: border-box red;
/* 단일 이미지, 중앙 배치 및 크기 조절 */
background: no-repeat center/80% url("../img/image.png");
'CSS' 카테고리의 다른 글
(CSS) 레이아웃 종류(Float, Flexbox, Grid) (0) | 2021.09.02 |
---|---|
(CSS) font-size: 62.5%, 왜 기본 페이지의 글꼴을 이렇게 정의할까? (0) | 2021.09.02 |
(CSS) @media (엣 미디어) (0) | 2021.09.02 |
(CSS) 100vh, 100vw (0) | 2021.08.09 |
CSS - <div> ,<span> 태그 (0) | 2021.07.19 |