CSS3 Transitions
CSS3 Transitions
CSS3 전환을 사용하는 방법?
전환 효과를 만들려면 두 가지를 지정해야합니다.
효과를 추가 할 CSS 속성
효과의 지속 시간
참고 : 기간 부분을 지정하지 않으면 기본값은 0이므로 전환 효과가 없습니다.
다음 예는 100 픽셀 * 100 픽셀 빨간색 <div> 요소를 보여줍니다. <div> 요소는 width 속성에 2 초의 전환 효과를 지정했습니다.
예
div {
width: 100px;
height: 100px;
background: red;
-webkit-transition: width 2s; /* Safari */
transition: width 2s;
}
전환 효과는 지정된 CSS 속성 (너비)이 값을 변경하면 시작됩니다.
이제 사용자가 <div> 요소 위에 마우스를 놓을 때 width 속성에 대한 새 값을 지정합니다.
예
div:hover {
width: 300px;
}
[전체소스]
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background: red;
-webkit-transition: width 2s; /* For Safari 3.1 to 6.0 */
transition: width 2s;
}
div:hover {
width: 300px;
}
</style>
</head>
<body>
<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>
<div></div>
<p>Hover over the div element above, to see the transition effect.</p>
</body>
</html>
커서가 요소 밖으로 마우스를 가져 가면 점차 원래 스타일로 다시 변경됩니다.
여러 속성 값 변경
다음 예제에서는 width 및 height 속성에 전환 효과를 추가합니다. 폭은 2 초, 높이는 4 초입니다.
예
div {
-webkit-transition: width 2s, height 4s; /* Safari */
transition: width 2s, height 4s;
}
[전체소스]
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background: red;
-webkit-transition: width 2s, height 4s; /* For Safari 3.1 to 6.0 */
transition: width 2s, height 4s;
}
div:hover {
width: 300px;
height: 300px;
}
</style>
</head>
<body>
<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>
<div></div>
<p>Hover over the div element above, to see the transition effect.</p>
</body>
</html>
게시판 목록
퍼블리셔팁
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 1217 | 반응형 | 3년 전 | 3105 | ||
| 1216 | 웹접근성 | 3년 전 | 2498 | ||
| 1215 | CSS | 4년 전 | 4904 | ||
| 1214 | 기타 | 4년 전 | 8363 | ||
| 1213 | CSS | 4년 전 | 3256 | ||
| 1212 | 웹접근성 | 4년 전 | 3644 | ||
| 1211 | CSS |
|
5년 전 | 4121 | |
| 1210 | 기타 | 5년 전 | 3346 | ||
| 1209 | CSS | 5년 전 | 3595 | ||
| 1208 | 기타 | 5년 전 | 3153 | ||
| 1207 | 기타 | 5년 전 | 2894 | ||
| 1206 | CSS |
moviepd
|
5년 전 | 3722 | |
| 1205 | HTML |
moviepd
|
5년 전 | 4386 | |
| 1204 | 기타 | 6년 전 | 7838 | ||
| 1203 | 웹접근성 | 6년 전 | 3015 | ||
| 1202 | 기타 | 6년 전 | 2990 | ||
| 1201 | 기타 | 6년 전 | 4327 | ||
| 1200 | 기타 | 6년 전 | 4124 | ||
| 1199 | 기타 | 6년 전 | 4135 | ||
| 1198 | 기타 | 6년 전 | 2616 | ||
| 1197 | 기타 | 6년 전 | 2689 | ||
| 1196 | 기타 | 6년 전 | 2471 | ||
| 1195 | 기타 | 6년 전 | 2460 | ||
| 1194 | 기타 | 6년 전 | 3049 | ||
| 1193 | 기타 | 6년 전 | 9237 | ||
| 1192 | 기타 | 6년 전 | 3886 | ||
| 1191 | 기타 | 6년 전 | 6226 | ||
| 1190 | 기타 | 6년 전 | 2445 | ||
| 1189 | 기타 | 6년 전 | 2347 | ||
| 1188 | 기타 | 6년 전 | 1826 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기