• Home
  • /
  • Modern Button Hover Effects with Cool Animations!

Modern Button Hover Effects with Cool Animations!

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>LearnWithArshyan - Hover Button</title>
    <link rel="stylesheet" href="style.css">
    </head>
  <body>
    <section class="container">
      <button class="btn">Learn More</button>
    </section>
  </body>
</html>
				
			

CSS

				
					* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.container {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: sans-serif;
  background: #fff;
}

.btn {
  border: none;
  padding: 1rem 4rem;
  background: red;
  color: white;
  font-size: 22px;
  text-transform: uppercase;
  position: relative;
  cursor: pointer;
}

.btn:before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  top: -10px;
  left: -10px;
  /* background: teal; */
  border-top: 4px solid red;
  border-left: 4px solid red;
  transition: all 0.25s;
}

.btn:hover:before,
.btn:hover:after {
  height: 100%;
  width: 100%;
}

.btn:after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  bottom: -10px;
  right: -10px;
  border-bottom: 4px solid red;
  border-right: 4px solid red;
  transition: all 0.25s;
}
				
			

Share this post

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top