Css Draw Effect
by Venkatesh Dematti
HTML
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CSS Border Transitions | Webdevtrick.com</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Border Transitions Effects</h1>
<section class="container">
<button class="draw">Draw</button>
<button class="draw meet">Draw Meet</button>
<button class="center">Center</button>
<button class="spin">Spin Box</button>
<button class="spin circle">Spin Circle</button>
</section>
</body>
</html>
CSS
body {
background: #fefefe;
font: 300 24px/1.5 Lato, sans-serif;
margin: 1em auto;
max-width: 36em;
padding: 1em 1em 2em;
text-align: center;
}
h1 {
font-weight: 300;
font-size: 2.5em;
}
.container {
isolation: isolate;
}
button {
background: none;
border: 0;
box-sizing: border-box;
margin: 1em;
padding: 1em 2em;
box-shadow: inset 0 0 0 2px #f45e61;
color: #f45e61;
font-size: inherit;
font-weight: 700;
position: relative;
vertical-align: middle;
}
button::before, button::after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
}
button:hover{
cursor:pointer;
}
.draw {
transition: color 0.25s;
}
.draw::before, .draw::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
.draw::before {
top: 0;
left: 0;
}
.draw::after {
bottom: 0;
right: 0;
}
.draw:hover {
color: #0eb7da;
}
.draw:hover::before, .draw:hover::after {
width: 100%;
height: 100%;
}
.draw:hover::before {
border-top-color: #0eb7da;
border-right-color: #0eb7da;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
.draw:hover::after {
border-bottom-color: #0eb7da;
border-left-color: #0eb7da;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
.meet:hover {
color: #0eb7da;
}
.meet::after {
top: 0;
left: 0;
}
.meet:hover::before {
border-top-color: #0eb7da;
border-right-color: #0eb7da;
}
.meet:hover::after {
border-bottom-color: #0eb7da;
border-left-color: #0eb7da;
transition: height 0.25s ease-out, width 0.25s ease-out 0.25s;
}
.center:hover {
color: #0eb7da;
}
.center::before, .center::after {
top: 0;
left: 0;
height: 100%;
width: 100%;
transform-origin: center;
}
.center::before {
border-top: 2px solid #0eb7da;
border-bottom: 2px solid #0eb7da;
transform: scale3d(0, 1, 1);
}
.center::after {
border-left: 2px solid #0eb7da;
border-right: 2px solid #0eb7da;
transform: scale3d(1, 0,...