Procedure
Step 1 - Basic HTML Structure: Set up the HTML with a div for the search bar, a search icon, and an input field. Include navigation and content sections for context.
Step 2 - Add Google Fonts: Import the 'Belanosima' and 'Rubik Vinyl' fonts from Google Fonts.
Step 3 - Style the Body: Use CSS to set height to 200vh for scrolling, set a background-color, and apply a font-family.
Step 4 - Create the Sticky Search Bar: Style the .darksoul-search-bar with width, height, background-color, border-radius, and box-shadow. Use position: fixed to keep it at the top center of the viewport and transition for smooth width change.
Step 5 - Style the Search Icon: Center the search icon within the bar using margin properties.
Step 6 - Add Hover Effect to Expand the Search Bar: Implement a :hover state to increase the width and adjust the border-radius.
Step 7 - Style the Search Input: Initially hide the input field with display: none. On hover, change display to inline-flex and set width and height.
Step 8 - Handle Small Screens: Use a media query (@media only screen and (max-width: 600px)) to adjust the search bar's width and border-radius.
By following these steps, you'll create an interactive and responsive sticky search bar that enhances user experience on your web page.