HTML5 Search Input: No Background Image in Chrome?

前端 未结 4 792
情深已故
情深已故 2020-12-28 08:06

I have been pulling my hair out trying to get Chrome to style my search input with a background image. Firefox has no problem, but I fear it\'s because it treat

4条回答
  •  醉酒成梦
    2020-12-28 08:39

    Like you said, Mozilla treats search inputs as text. For Webkit browsers however (Chrome, Safari), the search input is styled as a client created HTML wrapper for the internal Webcore Cocoa NSSearchField. This is what gives it the round edges and the 'x' button to clear itself when there is text within it. Unfortunately it seems that not only are these extra features inaccessible by CSS/JS for the time being, but it also seems that there's no W3 specification for what CSS properties can be applied to this element as well as other new HTML5 elements. Until there is such a specification I wouldn't expect to have consistent behavior.

提交回复
热议问题