본문 바로가기
  • 일하면서 배운 내용 끄적이는 블로그
HTML & CSS

웹 애니메이션 구현방법 by HTML & CSS

by dhl7799 2024. 2. 28.

CSS3 transition & CSS3 transform

HTML

<div class="wrap">
  <div class="container">
    <h1>Without transition</p>
    <div class="box1 box"></div>
  </div>
   <div class="container">
    <h1>With transition</p>
    <div class="box2 box"></div>
  </div>
</div>

 

SCSS

.wrap {
  margin: 50px;
}

.container {
  display: inline-block;
  width: 300px;
}

h1 {
  color: lightgray;
  font-family: lato;
  font-size: 20px;
  font-weight: 200;
  padding: 20px;
  text-align: center;
  text-transform: uppercase;
}

.box {
  border-radius: 5px;
  height: 40px;
  margin: 50px auto;
  width: 80px;
  
  .wrap:hover & {
    transform: scale(2);
  }
}

.box1 {
  background: mediumturquoise;
}

.box2 {
  background: #2b3f53;
  transition: all 1s;
}

 

https://thoughtbot.com/blog/transitions-and-transforms

'HTML & CSS' 카테고리의 다른 글

<template> 태그  (0) 2024.03.28
<hr> hr태그 색상 및 속성  (0) 2024.03.18
절대경로 & 상대경로  (0) 2024.03.15
form 태그 속성 정리  (1) 2024.03.14
CSS 메모  (0) 2024.03.05