-2

I tried to set a img before my option field. I tried

option::before
  {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url();
  }

But it doesn´t work. How to do it? It is not displayed in Firefox inspector. Normally there should be displayed ::before

cimmanon
  • 67,211
  • 17
  • 165
  • 171
ElDiabolo
  • 357
  • 5
  • 20

1 Answers1

1

Pseudo selectors are like empty DOM elements. And any element to be styled needs to have some content.

Your ::before pseudo element needs some content, which you can simply fill in using 'content' property.

option::before {
    content: '';
    display: inline-block;
    ...
}

Also note, you can use 'content' property to any HTML DOM element. And for pseudo selectors, they need to have a 'display' property along, unless positioned absolute or fixed.

scazzy
  • 950
  • 2
  • 8
  • 20