views:

42

answers:

2

Hi,

I would like to add some style on a select box with the pseudo :after (to style my select box with 2 parts and without images). Here's the HTML:

<select name="">
  <option value="">Test</option>
</select>

And it doesn't work. I don't know why and I didn't find the answer in the W3C specs. Here's the CSS:

select {
  -webkit-appearance: none;
  background: black;
  border: none;
  border-radius: 0;
  color: white;
}

select:after {
  content: " ";
  display: inline-block;
  width: 24px; height: 24px;
  background: blue;
}

So is it normal or is there a trick?

A: 

is this pseudo what you mean?

select:first-child {
    content: " ";
    display: inline-block;
    width: 24px;
    height: 24px;
    background: blue;
}
GusDe CooL
No I want to recreate a normal select box. select for the left part and select:after for the right part (the arrow). And I want to do it without images.
nmerouze
+1  A: 

I haven't checked this extensively, but I'm under the impression that this isn't (yet?) possible, due to the way in which select elements are generated by the OS on which the browser runs, rather than the browser itself.

David Thomas