개발하는 루루언니

CSS: hover 와 transition 사용해보기 본문

컴퓨터 정보/html.css.js 기초

CSS: hover 와 transition 사용해보기

혜닝혜루 2022. 11. 29. 16:38
728x90
반응형
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
  
a{
  border: 1px solid gray;
  display: inline-block;
  width: 120px;
  padding: 5px;
  text-align: center;
  color:black;
  text-decoration: none;
  border-radius: 10px;
  transition: 0.3s;
}

a:hover {
 background-color: black;
 color:white;
}
  </style>
</head>
<body>

  <a href="#">네이버</a>
  <a href="#">구글</a>
  <a href="#">다음</a>
</body>
</html>

hover 는 마우스를 올렸을때 나타나는 효과이다.

transition은 hover에 올려놓으면 마우스를때는  순간 없어지니

a 태그 안에 넣자 그러면 올릴때 땔때 둘다 애니매이션 효과가 난다.

728x90