Computer >> 컴퓨터 >  >> 프로그램 작성 >> JavaScript

CSS에서 백그라운드에서 이미지의 스크롤을 제어하는 ​​데 사용되는 속성은 무엇입니까?

<시간/>

배경에서 이미지의 스크롤을 설정하려면 background-attachment를 사용하세요. 재산.

예시

다음 코드를 실행하여 background-attachment 작업 방법을 배울 수 있습니다. 속성:

<!DOCTYPE html>
<html>
   <head>
      <style>
         body {
            background-image: url('/css/images/css.jpg');
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-attachment:scroll;
         }.
      </style>
   </head>
   <body>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
   </body>
</html>