Skip to content

CSS Animation – CSS Love Button

 


HTML CODE:

<!DOCTYPE html>
<html>
<head>
    <title>page</title>
    <link rel="stylesheet" type="text/css" href="1.page.css">
</head>
<body>

    <a href="#">
        <svg><rect></rect></svg>CSS LOVE</a>

</body>
</html>

CSS CODE:

body{
    margin: 0;
    padding: 0;
    background: #000
}
a{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 200px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    font-family: sans-serif;
    text-transform: uppercase;
    font-size: 24px;
    letter-spacing: 4px;
    color: #fff;
    text-decoration: none;
}
a svg,
a svg rect{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    fill: transparent;
}
a svg rect{
    stroke: #00e2ff;
    stroke-width: 4;
    transition: 2s;
    stroke-dasharray: 60 200;
    stroke-dashoffset: 320;
}
a:hover svg rect{
    stroke: #ff0;
    stroke-dasharray: 200 60;
    stroke-dashoffset: 0;
}

1 Comment »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: