🐨CoalaCoding
Docs▾
JavaScriptReactHTML & CSSBackendAI & LLMDev ToolsCreative
B반1
👾숏츠
🙉B반2
게시판
🐨CoalaCoding

개발자를 위한 한국어 웹 기술 문서

문서

  • JavaScript
  • React
  • HTML & CSS
  • Backend
  • AI & LLM
  • Dev Tools
  • Creative

커뮤니티

  • 게시판
  • 예제 모음

기타

  • 관리자

정책

  • 소개
  • 개인정보처리방침
  • 이용약관
  • 연락처
© 2026 CoalaCoding. All rights reserved.
  • 1. 선택자
  • 2. 문자
  • 3. 문단
  • 4. 박스모델
  • 5. 배경
  • 6. 레이아웃
  • 7. 트랜지션과-애니메이션
  • 8. 마스크
  • 10. hover효과
  • 11. var
  • 12. 클립패스
  • 13. 네스팅
  • 15. containerQuery
  • 16. 가로스크롤
  • 17. retina
  • 18. 반응형 햄버거메뉴
  • 19. 반응형-폰트크기
  • 20. svg
  • 21. 리퀴드글래스
  • 22. 폼디자인
  • 23. clamp(),min(),max()
  • 24. 세로정렬
  • 25. calc
  1. 홈
  2. 문서
  3. HTML & CSS
  4. CSS
  5. 10. hover효과

10. hover효과

2.마우스 오버 효과

1.1. button-hover

1.1.1. mouse-hover1

HTML

<a href="#"><span></span>hover me</a>

CSS

body {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-family: verdana;
    background-color: #272727;
}

a {
    width: 220px;
    height: 80px;
    color: #ff0;
    background-color: transparent;
    font-size: 26px;
    text-decoration: none;
    text-transform: uppercase;
    text-align: center;
    line-height: 80px;
    transition: all 0.5s;
    position: relative;
}

a:before,
a:after {
    content: '';
    position: absolute;
    top: 50%;
    width: 20px;
    height: 20px;
    background-color: #ff0;
    border-radius: 50%;
    transform: translateY(-50%);
    transition: all 0.3s;
    z-index: -1;
    opacity: 0;
}

a:before {
    left: 0;
    box-shadow: -100px 0 0 #ff0;
}

a:after {
    right: 0;
    box-shadow: 100px 0 0 #ff0;
}

a:hover:before {
    left: 50%;
    box-shadow: 30px 0 0 #ff0;
    transform: translateX(-50%) translateY(-50%);
    opacity: 1;
}

a:hover:after {
    right: 50%;
    box-shadow: -30px 0 0 #ff0;
    transform: translateX(50%) translateY(-50%);
    opacity: 1;
}

span {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ff0;
    border-radius: 8px;
    transform: scale(0);
    transition: all 0.3s;
    z-index: -1;
}

a:hover span {
    transform: scale(1);
    transition-delay: 0.4s;
}

a:hover {
    color: #262626;
    transition-delay: 0.4s;
}

1.1.2. mouse-hover2

HTML

<ul>
    <li>
        <a href="#">
            home
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </a>
    </li>

    <li>
        <a href="#">
            about
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </a>
    </li>

    <li>
        <a href="#">
            services
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </a>
    </li>

    <li>
        <a href="#">
            team
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </a>
    </li>

    <li>
        <a href="#">
            contact
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </a>
    </li>
</ul>

CSS

body {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-family: sans-serif;
}

ul {
    margin: 0;
    padding: 0;
    display: flex;
    list-style-type: none;
}

ul li a {
    display: block;
    width: 120px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    color: red;
    text-transform: capitalize;
    text-decoration: none;
    position: relative;
    transition: all 0.5s;
    color: #262626;
}

a:hover {
    color: white;
}

ul li span {
    position: absolute;
    width: 100%;
    height: 25%;
    background-color: #262626;
    z-index: -1;
    left: 0;
    top: 0;
    transform: scaleX(0);
    transition: all 0.5s;
    transform-origin: left;
}

a:hover span {
    transform: scaleX(1);
}

span:nth-child(2) {
    top: 25%;
    transition-delay: 0.15s;
}

span:nth-child(3) {
    top: 50%;
    transition-delay: 0.3s;
}

span:nth-child(4) {
    top: 75%;
    transition-delay: 0.45s;
}

1.1.3. mouse-hover3

HTML

<button class="btn">button</button>

CSS

body {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-family: sans-serif;
}

.btn {
    border: 2px solid tomato;
    background: none;
    color: tomato;
    padding: 20px 40px;
    font-size: 25px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.5s;
    position: relative;
    color: tomato;
    overflow: hidden;
}

.btn:hover {
    color: white;
}

.btn:before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: tomato;
    z-index: -1;
    border-radius: 50% 50% 0% 0%;
    height: 0%;
    transition: all 0.5s;
}

.btn:hover:before {
    height: 190%;
}

1.1.4. mouse-hover4

HTML

<!DOCTYPE html>
<html lang="ko">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>CSS animatin, transitions and transforms</title>

    
    <link rel="stylesheet" href="style.css" type="text/css" media="all">

    
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.2/css/all.css" integrity="sha384-/rXc/GQVaYpyDdyxK+ecHPVYJSN9bmVFBvjA/9eOB+pb3F2w2N6fc5qB9Ew5yIns" crossorigin="anonymous">


</head>

<body>

    <ul>
        <li><i class="fas fa-heart"></i></li>
        <li><i class="fas fa-glass-martini"></i></li>
        <li><i class="fas fa-globe"></i></li>
        <li><i class="fas fa-gift"></i></li>
    </ul>

</body>
</html>

CSS

body {
 margin: 0;
 display: flex;
 align-items: center;
 justify-content: center;
 height: 100vh;
 font-family: sans-serif;
}

ul {
  padding: 0;
  margin: 0;
  display: flex;
}

ul li {
  list-style-type: none;
  width: 120px;
  height: 120px;
  margin: 0 20px;
  border:2px solid #0a3d62;
  border-radius: 50%;
  transition: all 0.5s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

ul li i {
  font-size: 48px;
  color: #0a3d62;
  transition: 0.5s;
}

ul li:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #0a3d62;
  border-radius: 50%;
  transition: all 0.5s;
  opacity: 0;
  z-index: -1;
}

ul li:hover:before {
  opacity: 1;
  transform: scale(0.8);
}

ul li:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  border-radius: 50%;
  border:2px dashed #2e86de;
  transition: all 0.5s;
  opacity: 0;
  z-index: -1;
  box-sizing: border-box;
}

ul li:hover:after {
  opacity: 1;
  animation: rotating 10s linear infinite;
}

@keyframes rotating {
  0% { transform:scale(0.92) rotate(0deg); }
  100% { transform:scale(0.92) rotate(360deg); }
}

ul li:hover i {
  color: white;
}

1.2. image-hover

1.2.1. image-hover1

파일

예제이미지다운로드

HTML

  <div class="container">
      <img src="image.png">
      <div class="caption">
          <h1>amazing caption!</h1>
          <p>you can write anything here!</p>
      </div>
  </div>

CSS

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Lato', sans-serif;
}

.container {
    width: 500px;
    height: 500px;
    position: relative;
    overflow: hidden;
}

.container img {
    width: 100%;
    transition: all 0.5s;
}

.caption {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    transition: 0.5s;
    opacity: 0;
    background-color: rgba(0, 0, 0, 0);
}

.caption h1 {
    text-transform: uppercase;
    margin: 0;
}

.caption p {
    font-size: 18px;
    text-transform: capitalize;
}

.container:hover .caption {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.5);
}

.container:hover img {
    transform: scale(1.3) rotate(15deg);
}

1.2.2. image-hover2

파일

예제이미지다운로드

HTML

  <div>
      <img src="girl.jpg">
  </div>

CSS

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #4b4b4b;
}

div {
    width: 300px;
    height: 400px;
    border: 5px solid white;
    overflow: hidden;
}

img {
    width: 100%;
    height: 100%;
    transition: transform 1s;
}

img:hover {
    transform: scale(1.2) rotate(9deg);
}

목차

  • 1.1. button-hover
  • 1.1.1. mouse-hover1
  • 1.1.2. mouse-hover2
  • 1.1.3. mouse-hover3
  • 1.1.4. mouse-hover4
  • 1.2. image-hover
  • 1.2.1. image-hover1
  • 1.2.2. image-hover2