Text Mirrors

Used Properties: transition, inset, position, flex,filter,overflow

style.css

*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
body{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color:black;
}
button{
    position: relative;
    border: 0;
    outline: none;
    background: none;
    color: #fff;
    text-transform: uppercase;
    font-size: 4rem;
    letter-spacing: 2px;
    font-weight: 800;
    cursor: pointer;    
    filter: drop-shadow(2px 2px 5px #fff);
    margin-top: 20px;
    transition: margin-top 1s;
}
button:hover{
    margin-top: 90px;
}
.htext{
    position: absolute;
    color:black;
    width: 0%;
    inset: 10px;
    overflow: hidden;
    border-right: 5px solid red;
    transition: width 1s ease-in-out;
   
}
button:hover .htext{
    width: 100%;
}

index.html

<!DOCTYPE html>

<html lang="en">

  <head>

    <meta charset="UTF-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>TEXT MIRROR</title>

    <link rel="stylesheet" href="style.css" />

  </head>

  <body>

    <button>

      HTML

      <span class="htext">HTML</span>

    </button>

  </body>

</html>

Leave a Comment

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

Scroll to Top