요소의 배경 스타일을 지정하려면 배경 이미지, 배경 위치를 설정할 수 있습니다. 그와 함께 배경 반복을 설정하여 이미지를 가로 또는 세로로 반복합니다.
배경 위치
배경 위치는 배경 이미지의 시작 위치를 설정하는 것입니다. 이를 위해 background-position 속성을 사용하십시오.
예시
이제 예를 살펴보겠습니다 -
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url("https://www.tutorialspoint.com/images/Swift.png");
background-repeat: no-repeat;
background-attachment: fixed;
color: blue;
background-position: left center;
}
.demo {
text-decoration: overline underline;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html> 출력

배경 반복
CSS의 배경 반복은 웹 페이지에서 배경 이미지가 반복되는 방식을 설정하는 데 사용됩니다. 이를 위해 background-repeat 속성을 사용하십시오. 다음은 속성 값일 수 있습니다. -
background-repeat: repeat|repeat-x|repeat-y|no-repeat|initial|inherit;
예시
이제 예를 살펴보겠습니다 -
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url("https://www.tutorialspoint.com/images/Swift.png");
background-repeat: repeat-x;
background-color: blue;
color: white;
}
.demo {
text-decoration: overline underline;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html> 출력
