Within my CSS, I have included the code snippet below:
#myInput {
background-image: url('/css/searchicon.png');
background-position: 10px 10px;
background-repeat: no-repeat;
width: 100%;
font-size: 16px;
padding: 12px 20px 12px 40px;
border: 1px solid #ddd;
margin-bottom: 12px;
}
This code creates a search box with the following HTML structure:
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for names.." title="Type in a name">
The current appearance of the search box is shown here: https://i.sstatic.net/UEtbL.png
My desired look for the search box is illustrated in this image: https://i.sstatic.net/RlvP3.png
Please keep in mind that the search icon file used is stored in the css folder. This example is inspired by this website.