티스토리 뷰
반응형
1) perspective-origin
원근 거리의 기준점을 설정 - 어디서 바라볼 것이냐
속성 값
값 | 의미 | 기본값 |
X축 | left, right, center, %, 단위 | 50% |
Y축 | top, bottom, center, %, 단위 | 50% |
사용법1
perspective-origin: 50% 50%;
<div class="perspective">
<div class="grand-parent">
<div class="parent">
<img
src="https://heropy.blog/css/images/logo.png"
alt="HEROPY">
</div>
</div>
</div>
.perspective {
width: 200px;
perspective:600px;
perspective-origin: 50% 50%;
padding: 70px;
}
.grand-parent {
width: 200px;
border: 3px solid dodgerblue;
transition: 1s;
transform: rotateX(-45deg);
transform-style: preserve-3d;
/* transform-style: flat; */
}
.parent {
width: 200px;
border: 3px solid tomato;
transition: 1s;
transform: rotateY(45deg);
transform-style: preserve-3d;
}
img {
width: 200px;
border: 3px solid lightgray;
transition: 1s;
transform: rotateX(45deg);
}
사용법2
perspective-origin: 100% 200%;
<div class="perspective">
<div class="grand-parent">
<div class="parent">
<img
src="https://heropy.blog/css/images/logo.png"
alt="HEROPY">
</div>
</div>
</div>
.perspective {
width: 200px;
perspective:600px;
perspective-origin: 100% 200%;
padding: 70px;
}
.grand-parent {
width: 200px;
border: 3px solid dodgerblue;
transition: 1s;
transform: rotateX(-45deg);
transform-style: preserve-3d;
/* transform-style: flat; */
}
.parent {
width: 200px;
border: 3px solid tomato;
transition: 1s;
transform: rotateY(45deg);
transform-style: preserve-3d;
}
img {
width: 200px;
border: 3px solid lightgray;
transition: 1s;
transform: rotateX(45deg);
}
반응형
'HTML CSS JS' 카테고리의 다른 글
CSS) 변환 속성 - matrix() (0) | 2021.10.27 |
---|---|
CSS) 변환속성 - backface-visibility (0) | 2021.10.26 |
CSS) 변환 속성 - perspective (0) | 2021.10.19 |
CSS) 변환속성 - transform-style (0) | 2021.10.19 |
CSS) 변환 속성 - transform-origin (0) | 2021.10.19 |
댓글
공지사항