on focus animation

by Dru Dro

HTML

<form>
    <div class="container">
        <input type="text" placeholder="search">
        <button type="submit" class="btn">☠</button>
        </input>
    </div>
</form>

CSS

* {
    color: white;
    background: black;
}
.container {
    position: relative;
    overflow: hidden;
    width: 452px;
    height: 75px;
    background: black;
    padding: 25px;
    box-sizing: padding-box;
}
input, button {
    transition: all .3s ease-in-out;
    float: left;
    display: block;
    margin: 0;
    padding: 0;
    height: 75px;
    outline: none;
    border: none;
}
input {
    left: 75px;
    position: relative;
    width: 325px;
    border-right: 2px solid white;
}
button {
    cursor: pointer;
    position: absolute;
    width: 75px;
    font-size: 32px;
    left: 0
}
input:focus {
    padding-right: 50px;
}
input:focus ~ button {
    left: -25px;
}