반응형
아래 소스 코드는 CSS를 사용하여 텍스트와 이미지에 깜빡이는 애니메이션 효과를 적용하는 예시입니다.
<style>
@-webkit-keyframes 'blink' {
80% { background: rgba(255,0,0,1); }
}
@-webkit-keyframes 'blink-image' {
0% { opacity: 0; }
50% { opacity: 1; }
100% { opacity: 0; }
}
.blink {
-webkit-animation-direction: normal;
-webkit-animation-duration: 0.9s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-name: blink;
-webkit-animation-timing-function: ease;
}
.blink-image {
-webkit-animation-direction: normal;
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-name: blink-image;
-webkit-animation-timing-function: ease;
}
</style>
<div style="color:yellow;">
<span class="blink">안녕하세요. 반갑습니다.</span>
</div>
<div style="margin-top:20px;">
<img class="blink-image" src="https://via.placeholder.com/100x100/BE81F7/FFFF00&text=HELLO" alt="깜빡이는 이미지">
</div>
반응형
'개발이야기 > HTML&CSS' 카테고리의 다른 글
[HTML&CSS] details, summary 태그로 아코디언 메뉴 만들기 (접기/펼치기) (0) | 2023.09.08 |
---|---|
[HTML&CSS] datalist 태그 사용해서 자동완성 구현하기 (0) | 2023.09.08 |
[HTML&CSS] img 태그 이미지 없을 때 대체 이미지 띄우기, 안 보이게 하기 (onerror) (0) | 2023.09.08 |
[HTML&CSS] 색상 선택하기 (color picker) 사용법, 예제 (1) | 2023.07.19 |
[HTML&CSS] 웹 페이지 가로모드 체크하기 (CSS 미디어 쿼리) (0) | 2023.04.14 |
댓글