실전퍼블리싱(네비게이션 호버이펙트-Rotate)

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

네비게이션 호버이펙트-Rotate


요소의 앞뒤를 디자인 하는 가상클래스 before, after를 활용하여 SNS아이콘 애니메이션 네이게이션 만들기

예제보기

HTML

  <div class="gnb">
    <a href="javascript:viod(0)">CodingWorks Online Class</a>
  </div>

CSS

/* Google Web Font */
@import url('https://fonts.googleapis.com/css?family=Raleway&display=swap');

/* 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;
  line-height: 1.5em;
  margin: 0;
  font-weight: 300;
  background-color: #34465d;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}
a {
  text-decoration: none;
  color: #fff;
}

.gnb a {
  text-transform: uppercase;
  position: relative;
  width: 400px;
  display: block;
  text-align: center;
  padding: 15px;
  box-sizing: border-box;
  transition: 0.3s;
}
.gnb a::before,
.gnb a::after {
  content: '';
  position: absolute;
  background-color: rgba(255, 255, 255, 0.05);
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  border: 1px solid #7e7e7e;
  transition: 0.3s;
}
.gnb a:hover {
  letter-spacing: 5px;
}
.gnb a:hover::before {
  transform: rotate(45deg);
  background-color: transparent;
}
.gnb a:hover::after {
  transform: rotate(-45deg);
  background-color: transparent;
}
profile
프론트엔드 4년차

0개의 댓글