1

Any idea why this is working in Safari, but not Firefox and Chrome?

HTML:

<input type="search" placeholder="Search" id="search" name="search" id="s" data-icon="s">

CSS:

#search[data-icon]:before {
    font-family: 'Pictos Custom';
    content: attr(data-icon);
    -webkit-font-smoothing: antialiased;
}

Any help appreciated.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
realph
  • 4,481
  • 13
  • 49
  • 104

1 Answers1

4

Keep in mind you can't use pseudo-elements on replaced elements which includes <img> <select> <input> <object> etc. basically elements that have no content

Refer to the Visual Formatting Model in the 2.1 Spec for more info

Community
  • 1
  • 1
Adrift
  • 58,167
  • 12
  • 92
  • 90