실전퍼블리싱(before, after 활용 SNS 아이콘 애니메이션)

Dev_Go·2022년 7월 11일
0
post-thumbnail

before, after 활용한 애니메이션 hover 이펙트


예제보기

HTML

  <div class="sns">
    <a href="javascript:viod(0)"><i class="fa fa-facebook"></i></a>
    <a href="javascript:viod(0)"><i class="fa fa-twitter"></i></a>
    <a href="javascript:viod(0)"><i class="fa fa-google-plus"></i></a>
    <a href="javascript:viod(0)"><i class="fa fa-linkedin"></i></a>
    <a href="javascript:viod(0)"><i class="fa fa-instagram"></i></a>
  </div>

CSS

/* Fontawesome 4.7 */
@import url('https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');

body {
  font-family: 'Raleway', 'sans-serif';
  color: #222;
  line-height: 1.5em;
  margin: 0;
  font-weight: 300;
  /* 수직 수평 중앙 */
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}
a {
  color: #222;
  text-decoration: none;
}

.sns {
  margin: 0;
  background-color: #f0f0f0;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  padding: 40px;
}
.sns a{
  border: 1px solid #fff;
  display: inline-block;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: #fff;
  font-size: 40px;
  text-align: center;
  line-height: 80px;
  margin: 0 10px;
  position: relative;
  overflow: hidden;
}
.sns a::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 0;
  background-color: blue;
  top: 0;
  left: 0;
  transition: 0.5s;
}
.sns a:hover::before {
  height: 100%;
}
.sns a:nth-child(1)::before {
  background-color: #1877F2;
}
.sns a:nth-child(2)::before {
  background-color: #1DA1F2;
}
.sns a:nth-child(3)::before {
  background-color: #dd4b39;
}
.sns a:nth-child(4)::before {
  background-color: #0077b5;
}
.sns a:nth-child(5)::before {
  background-color: #E4405F;
}
.sns a .fa {
  position: relative;
  transition: 0.5s;
}
.sns a:hover .fa {
  transform: rotateY(360deg);
  color: #fff;
}
profile
프론트엔드 4년차

0개의 댓글