<div class="layout">
  <!-- ここからボタンのHTML -->
  
  <div class="button">
    <a href="#"><span>ボタン</span></a>
  </div>
  
  <!-- ここまでボタンのHTML -->
</div>
/* ここはレイアウトなのでボタンとは関係ない */
* {
  margin: 0;
}

.layout {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 50px;
  width: 100%;
  height: 100vh;
}

/* ここからボタンのCSS */
.button {
	a {
		position: relative;
		display: block;
		width: 240px;
		height: 50px;
		font-size: 16px;
		text-decoration: none;
		background-color: transparent;
		color: #5cc0ef;
		transition: all 0.3s;

		&::before,
		&::after {
			content: "";
			position: absolute;
			height: 0%;
			width: 2px;
			background-color: #5cc0ef;
		}

		&::before {
			top: 0;
			right: 0;
			transition: all 0.1s 0.2s ease;
		}

		&::after {
			bottom: 0;
			left: 0;
			transition: all 0.1s ease;
		}

		span {
			position: relative;
			display: flex;
			justify-content: center;
			align-items: center;
			width: 100%;
			height: 100%;

			&::before,
			&::after {
				content: "";
				position: absolute;
				width: 0%;
				height: 2px;
				background-color: #5cc0ef;
			}

			&::before {
				top: 0;
				left: 0;
				transition: all 0.1s 0.3s ease;
			}

			&::after {
				bottom: 0;
				right: 0;
				transition: all 0.1s 0.1s ease;
			}
		}

		&:hover {
			&::before {
				height: 100%;
				transition: all 0.1s ease;
			}

			&::after {
				height: 100%;
				transition: all 0.1s 0.2s ease;
			}

			span::before {
				width: 100%;
				transition: all 0.1s ease;
			}

			span::after {
				width: 100%;
			}
		}
	}
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.