| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- #웹솔루션
- 솔루션
- 이미지
- #이미지
- php
- #솔루션
- #jQuery
- 게시판
- 사이트제작
- #업종별
- #홈페이지제작
- CSS
- #CSS
- #cgimall
- 홈페이지제작
- #동영상
- 홈페이지
- 웹솔루션
- #happycgi
- javascript
- #해피CGI
- #image
- #쇼핑몰
- #홈페이지
- happycgi
- 해피CGI
- CGIMALL
- jquery
- #뉴스
- 해피씨지아이
- Today
- Total
웹솔루션개발 25년 노하우! 해피CGI의 모든것
[해피CGI][cgimall] 로딩되기 전에 애니메이션 구현하기 Skeleton loading using only a few lines of CSS 본문
[해피CGI][cgimall] 로딩되기 전에 애니메이션 구현하기 Skeleton loading using only a few lines of CSS
해피CGI윤실장 2025. 12. 18. 09:05
HTML 구조
<div class="container">
<!-- code here -->
<div class="card">
<div class="card-img skeleton">
<!-- waiting for img to load from javascript -->
</div>
<div class="card-body">
<h2 class="card-title skeleton">
<!-- wating for title to load from javascript -->
</h2>
<p class="card-intro skeleton">
<!-- waiting for intro to load from Javascript -->
</p>
</div>
</div>
<div class="card">
<div class="card-img">
<img src="https://assets.codepen.io/285131/uslmOwQpdRRUwr6AmBP6JdzeHjS.jpg" />
</div>
<div class="card-body">
<h2 class="card-title">
Drive (2011)
</h2>
<p class="card-intro">
Driver is a skilled Hollywood stuntman who moonlights as a getaway driv...
</p>
</div>
</div>
</div>
CSS(SCSS) 소스
*, *:after, *:before {
box-sizing: border-box;
}
body {
font-family: "Inter", sans-serif;
background-color: #f2f5f7;
}
// THE CARD
.card {
display: flex;
flex-direction: column;
flex-basis: 300px;
flex-shrink: 0;
flex-grow: 0;
max-width: 100%;
background-color: #FFF;
box-shadow: 0 5px 10px 0 rgba(#000, .15);
border-radius: 10px;
overflow: hidden;
margin: 1rem;
}
.card-img {
padding-bottom: 56.25%;
position: relative;
img {
position: absolute;
width: 100%;
}
}
.card-body {
padding: 1.5rem;
}
.card-title {
font-size: 1.25rem;
line-height: 1.33;
font-weight: 700;
&.skeleton { // NOTICE THIS
min-height: 28px;
border-radius: 4px;
}
}
.card-intro {
margin-top: .75rem;
line-height: 1.5;
&.skeleton { // NOTICE THIS
min-height: 72px;
border-radius: 4px;
}
}
// THE LOADING EFFECT
.skeleton {
background-color: #e2e5e7;
// The shine that's going to move across the skeleton:
background-image:
linear-gradient(
90deg,
rgba(#fff, 0),
rgba(#fff, 0.5),
rgba(#fff, 0)
);
background-size: 40px 100%; // width of the shine
background-repeat: no-repeat; // No need to repeat the shine effect
background-position: left -40px top 0; // Place shine on the left side, with offset on the left based on the width of the shine - see background-size
animation: shine 1s ease infinite; // increase animation time to see effect in 'slow-mo'
}
@keyframes shine {
to {
// Move shine from left to right, with offset on the right based on the width of the shine - see background-size
background-position: right -40px top 0;
}
}
// Codepen spesific styling - only to center the elements in the pen preview and viewport
.container {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
// End Codepen spesific styling
첨부파일을 다운로드하거나 해당 사이트로 이동하여 전체 소스를 확인하실 수 있습니다.
'웹프로그램밍 자료실 > 기타 자료' 카테고리의 다른 글
| [해피CGI][cgimall] Electric Border (0) | 2025.12.22 |
|---|---|
| [해피CGI][cgimall] Interactive Blackhole (0) | 2025.12.19 |
| [해피CGI][cgimall] 클릭하면 아이콘이 나오는 바 애니메이션 Chat Bar Interaction (0) | 2025.12.17 |
| [해피CGI][cgimall] 소음진동,대기질,온실가스 등 61종의 환경영향평가 데이터 제공 - OPEN API (0) | 2025.12.15 |
| [해피CGI][cgimall] designus 디자이너스 국내 ui/ux 벤치마킹 사이트 (0) | 2025.12.02 |

