CSS 배경 부착

CSS background-attachment

background-attachment 속성은 배경 이미지가 롤링되거나 고정되는지 지정합니다(페이지의 나머지 부분과 함께 롤링되지 않습니다):

예제

배경 이미지를 고정하도록 지정합니다:

body {
  background-image: url("tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: fixed;
}

직접 시도해 보세요

예제

배경 이미지가 페이지의 나머지 부분과 함께 롤링되도록 지정합니다:

body {
  background-image: url("tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: scroll;
}

직접 시도해 보세요