Table of Contents

How to make Search Bar using html css

Share Now :

Titile : How to make Search Bar using html css.


The search bar is a ubiquitous element in web design, allowing users to find specific content easily. Creating a visually appealing and functional search bar can significantly improve the user experience on your website. In this tutorial, you will learn How to make Search Bar using html css. By the end of this guide, you’ll have a beautiful and functional search bar that you can integrate into your web projects.

Step 1: Set Up Your HTML Structure.

To get started, create a basic HTML structure to create a search bar. Here’s the HTML code to create search bar in a file called “index.html”:

  <!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <title>Stylish Search Bar</title>
    <div class="search-container">
        <input type="text" class="search-box" placeholder="Search...">
        <button class="search-button">Search</button>

Step 2: Apply Basic CSS Styling

Next, we will add some basic CSS style elements to our HTML structure to style our search bar. Here is the CSS code in a file called “style.css”:

  /* Style the search container */
.search-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px;

/* Style the search box */
.search-box {
    padding: 10px;
    width: 300px;
    border: 1px solid #007BFF;
    border-radius: 25px;
    outline: none;

/* Style the search button */
.search-button {
    padding: 10px 20px;
    background-color: #007BFF;
    color: #fff;
    border: none;
    border-radius: 25px;
    margin-left: 10px;
    cursor: pointer;

/* Adjust button appearance on hover */
.search-button:hover {
    background-color: #0056b3;

Step 3: Customize and Enhance

In this example, we’ve created a simple search bar with a text input field and a search button. You can customize it further by experimenting with colors, fonts, padding, and other styles to match your website’s design.


How to make Search Bar using html css is a fundamental skill for web designers and developers. It not only enhances the aesthetics of your website but also provides a convenient way for users to find the content they’re looking for. By following this step-by-step guide, you can create an attractive and functional search bar that complements your website’s design and improves the user experience. Feel free to adapt and expand upon this example to suit your specific needs.