• 회원가입
  • 로그인
  • 구글아이디로 로그인

[DOM_Style] JS - backgroundAttachment 속성 ★ - 배경이미지고정 설정/반환

목차
  1. backgroundAttachment 예제 - 배경이미지 고정 설정
  2. backgroundAttachment 정의
  3. backgroundAttachment 구문

 

backgroundAttachment 예제 - 배경이미지 고정 설정

 

<style>

body {

  background: Tomato url('https://i.imgur.com/PQNhCln.gif') no-repeat right top;

}

</style>


<body>


<h1>홈짱닷컴</h1>

<p>Homzzang.com</p>


<button onclick="homzzang()">클릭</button>

<p id='demo'></p>

 

<script>

function homzzang() {

  document.body.style.backgroundAttachment = "fixed";

}

var i = 0

var text = '';

for(i = 0; i < 30 ; i++) {

  text += "홈페이지 제작관리 + 서버관리<br>";

  document.getElementById('demo').innerHTML = text;

}

</script>

 

결과보기

 

backgroundAttachment 정의

 

배경이미지를 "고정시킬건지, 스크롤과 함께 움직이게 할건지" 설정/반환.

 


 

CSS background-attachment 속성 참고.

 

 

backgroundAttachment 구문

 

배경이미지 고정 반환

object.style.backgroundAttachment

 

배경이미지 고정 설정

object.style.backgroundAttachment = "scroll|fixed|local|initial|inherit"

 


[속성값]

 

CSS background-attachment 속성 참고.

 


[반환값]

 

배경이미지가 문서 안 객체에 어떤 식으로 부착되었는지 나타내는 문자열.

 

 


분류 제목
DOM_Style JS - borderLeftStyle -
DOM_Style JS - borderLeftWidth -
DOM_Style JS - borderRadius 속성 ★ - 테두리 둥글게 설정/반환 = 둥근 테두리 = 보더레이디어스 속성…
DOM_Style JS - borderRight -
DOM_Style JS - borderRightColor -
DOM_Style JS - borderRightStyle -
DOM_Style JS - borderRightWidth -
DOM_Style JS - borderSpacing 속성 - 테이블의 셀 간 간격 설정/반환 (= borderSpacing속성…
DOM_Style JS - borderStyle 속성 - 테두리스타일
DOM_Style JS - borderTop 속성 - 테두리상단 (= 상단테두리)
DOM_Style JS - borderTopColor -
DOM_Style JS - borderTopLeftRadius -
DOM_Style JS - borderTopRightRadius -
DOM_Style JS - borderTopStyle -
DOM_Style JS - borderTopWidth -
DOM_Style JS - borderWidth 속성 - 테두리두께 (= 보더위드스속성 = border-width속성) ★
DOM_Style JS - bottom 속성 - 기준하단 (= bottom속성 = 하단기준 = 아래기준 = 바텀속성 = 보텀속…
DOM_Style JS - boxDecorationBreak -
DOM_Style JS - boxShadow 속성 - 상자그림자 (= box-shadow속성 = 박스그림자 = 요소그림자 = …
DOM_Style JS - boxSizing 속성 - (박스너비 = 박스전체너비 =박스총너비) 결정방식 (= 박스사이징속성, …
3/10
목록
찾아주셔서 감사합니다. Since 2012