VOOZH about

URL: https://www.geeksforgeeks.org/css/create-a-search-bar-using-html-and-css/

⇱ How to Create a Search Bar using HTML and CSS - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Create a Search Bar using HTML and CSS

Last Updated : 25 Jun, 2025

Creating a search bar in HTML and CSS is simple and essential for enhancing user experience on your website. A search bar allows users to quickly find specific content, making it a common feature in website navigation menus. In this guide, we'll show you how to create a search bar in HTML.

👁 searchbar

By following the steps below, you'll learn how to make a search bar in HTML that's both functional and visually appealing. Whether you're looking to add a search box for a website or integrate a stylish search bar for your website using HTML and CSS.

Approach

To create a functional and attractive search bar, we’ll break the task into two parts:

HTML Setup

  • Start with a basic HTML document and include a <meta> tag for responsive design.
  • Create a navigation bar (navlist) containing menu links like Home, Our Products, Careers, About Us, and Contact Us.
  • Add a search form inside a right-aligned <div> containing:
    • A text input field with placeholder text (e.g., “Search Courses”)
    • A search button with a search icon (using Font Awesome)

CSS Styling

  • Use Flexbox to arrange navigation links and the search bar.
  • Style the search input and button with padding, borders, hover effects, and responsive behavior.
  • Design a content section featuring the GeeksforGeeks logo, tagline, and a short description to reinforce branding and purpose.

Example: The code example shows the implementation of the above-explained approach.

Output:

You’ve now created a stylish, responsive, and accessible search bar using HTML and CSS! This design is lightweight, easy to customize, and ready to enhance any website’s navigation. Experiment with different styles and test it thoroughly to ensure a seamless user experience.

Comment
Article Tags: