in Web & Tech

Styling input type=”search”…

When you use a input of type search and try to style it via CSS you might go crazy upon all your fancy decoration not displaying properly. Even custom borders won’t, at least on webkit browsers.

It’s easy to fix by applying the appearance property on the selector matching your input field. This will destroy the browser’s default styling:

-moz-appearance: none;
-webkit-appearance: none;

Update: and the button to reset the form value can be removed, too:

input[type=search]::-webkit-search-cancel-button {
     display: none;
}

Write a Comment

Comment

  • Related Content by Tag