Skip to content
Advertisements

CSS SEARCH DESIGN-2

Screenshot_1.png

HTML CODE:

<!DOCTYPE html>
<html>
<head>
    <title>SEARCH BOX</title>
    <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>


    <link rel="stylesheet" type="text/css" href="2.page.css">
</head>
<body>
    <img src="https://wallpaper-house.com/data/out/5/wallpaper2you_55315.jpg" width="400px" height="1000px">
    <div class="search-box">
        <input class="search-txt" type="text" name="" placeholder="Type to search...">
        <a class="search-btn" href="#">
            <i class="fas fa-search"></i>
        </a>
        
    </div>

</body>
</html>

CSS CODE:

body{
    margin: 0;
    padding: 0;
    background-color: #e84118;
}
.search-box{
    position: absolute;
    top: 50%;
    left: 50%;
    transition: (-50%,-50%);
    background-color: #2f3640;
    height: 40px;
    border-radius: 40px;
    padding: 10px
}
.search-box:hover > .search-txt{
    width: 240px;
    padding: 0 6px; 
}
.search-box:hover > .search-btn{
    background: white
}
.search-btn{
    color: #e84118;
    float: right;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #2f3640;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.4s
}
.search-txt{
    border:none;
    background: none;
    outline: none;
    float: left;
    padding: 0;
    color: white;
    font-size: 16px;
    transition: 0.4s;
    line-height: 40px;
    width: 0px;
}
Advertisements

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: