Web/WEB기본

[CSS] 배경 이미지 고정하기 ( background-attachment 속성 )

saltdoll 2013. 11. 14. 10:25
반응형

배경 이미지 고정되게 처리하기

body { 

background-image: url(bg.gif); 

background-attachment: fixed;

background-repeat: no-repeat

}


배경의 그림을 스크롤링의 설정 background-attachement 속성의 fixed 값을 통해서 처리한다.



CSS background-attachment Property

http://www.w3schools.com/cssref/pr_background-attachment.asp


Definition and Usage

The background-attachment property sets whether a background image is fixed or scrolls with the rest of the page.

Default value:scroll
Inherited:no
Version:CSS1
JavaScript syntax:

object.style.backgroundAttachment="fixed"


Property Values

ValueDescription
scrollThe background scrolls along with the element. This is default
fixedThe background is fixed with regard to the viewport
localThe background scrolls along with the element's contents




배경 고정 예제 파일

배경고정_fixed.zip

반응형
도움이 되셨다면 하트모양의 "♡ 공감"을 눌러주시면 큰 격려가 됩니다.
(로그인하지 않으셔도 가능)