CSS background image not appearing in Safari

后端 未结 3 866
臣服心动
臣服心动 2021-01-26 16:12

I have the very simple task of applying a background image to a DIV. I can view the image with every other browser except Safari. Can someone take a look at my CSS and site and

3条回答
  •  滥情空心
    2021-01-26 16:48

    Apparently Safari--or at least some versions of it--refuses to apply CSS to form fields, so if you have a clever little search box like I do, Safari won't render any CSS applied to it. I thought it was specific to my use of SVGs and then I thought it had something to do with the short code. I was stuck until I found an obscure post on GitHub from a MarcHaunschild from 2011 discussing this behavior. Anyway in the case that you're trying to style a field such as a search box, here's the fix.

    Add the following to your CSS:

    input[type="search"] {
      -webkit-appearance: textfield;
    }
    

提交回复
热议问题