Search box with search icon using HTML and CSS

 Make a search box using HTML and CSS - 


Watch on You Tube


Make a search box using HTML and CSS -




HTML -


<!DOCTYPE html>

<html>

<head>

<title>Search Box</title>

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

<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

</head>

<body>


<h1>Search Box</h1>

<div class="box">

<i class="fa fa-search" aria-hidden="true"></i>

<input type="text" name="">

</div>


</body>

</html>



CSS - 


*{

margin: 0;

padding: 0;

font-family: sans-serif;

box-sizing: border-box;

}

body{

height: 100vh;

display: flex;

justify-content: center;

align-items: center;

background: linear-gradient(25deg, #8600b3 50%, #cc33ff 50%);

}

h1{

position: absolute;

top: 30%;

font-size: 60px;

color: white;

}

.box{

width: 500px;

height: 50px;

background-color: white;

border-radius: 30px;

display: flex;

align-items: center;

padding: 20px;

}

.box > i {

font-size: 20px;

color: #777;

}

.box > input{

flex: 1;

height: 40px;

border: none;

outline: none;

font-size: 18px;

padding-left: 10px;

}


Font Awesome CDN link - 

https://www.bootstrapcdn.com/fontawesome/


Font Awesome Icon Link - 

https://fontawesome.com/v4.7.0/icons/



Thank You

Comments