background-color: <색상>
background-color: #00ff00; /* 16진수 표현 */
background-color: rgb(0, 255, 0); /* rgb 표현 */
background-color: green; /* 색상이름 */
배경 색 스타일과 상속
<html>
<head>
<meta charset="utf-8">
<style>
body {
background-color: #0094ff;
}
div {
background-color: white;
width: 90%;
padding: 15px;
border: 1px solid balck;
}
p {
line-height: 30px;
}
</style>
</head>
<body>
<div>
<p>
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
</p>
</div>
</body>
</html>
background-clip: border-box | padding-box | content-box
속성
<html>
<head>
<meta charset="utf-8">
<style>
.bg1 { background-clip: border-box; }
</style>
</head>
<body>
<div class="bg1" style="width: 300px;">
<p>
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록
</p>
</div>
</body>
</html>
<style>
body { background-image: url('test.png'); }
</style>
bakground-repeat: repeat | repeat-x | repeat-y | no-repeat
속성
<html>
<head>
<meta charset="utf-8">
<style>
body {
background-image: url("dot.png");
background-repeat: repeat;
}
</style>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
실행결과
[CSS 기초] 테두리 관련 속성들 (0) | 2021.04.27 |
---|---|
[CSS 기초] CSS와 박스 모델 (0) | 2021.04.26 |
[CSS 기초] 목록 스타일 (0) | 2021.04.23 |
[CSS 기초] 문단 스타일 (2) (0) | 2021.04.21 |
[CSS 기초] 문단 스타일 (1) (0) | 2021.04.20 |
댓글 영역