Reputation: 545
input[type="search"] {
-webkit-appearance: searchfield;
}
<input type="search" />
makes the clear (X) button appear when you type something in the input, but how do you make the same thing happen in Firefox?
Upvotes: 20
Views: 9965
Reputation: 27284
Firefox has been dragging their feet on this for years and years. Contrary to the other answer, there is still (as of late 2017) no native way of including a clear button on an input. You can of course insert your own and style it manually, in which case you'd do well to use
input[type="search"]::-webkit-search-cancel-button { display: none }
to avoid having the native clear button show up on browsers that support it.
Upvotes: 15