Skip to content

CSS Animation – Check


HTML CODE:

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

    <div class="center">
        <label>
            <input type="checkbox" name="">The world is not a flat tray.
        </label>
    </div>

</body>
</html>

CSS CODE:

body{
    margin: 0;
    padding: 0;
}
.center{
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    transform: translate(-50%,-50%);
    text-align: center;
}
input[type="checkbox"]{
    position: relative;
    top:8px;
    width: 40px;
    height: 40px;
    -webkit-appearance:none;
    outline: none;
    transition: .5s;
}
input[type="checkbox"]:before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border:4px solid #262626;
    box-sizing: border-box;
    transition: .5s;
}
input:checked[type="checkbox"]:before{
    border-left: none;
    border-top: none;
    width: 20px;
    border-color: #0f0;
    transform: rotate(45deg) translate(5px,-10px);
}
label{
    font-size: 36px;
    font-family: sans-serif;
}

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: