petko_stankoski
petko_stankoski

Reputation: 10713

Setting image as a background to a select tag

Here is the css part:

#selectTagId{
    background-color: transparent;
    color: white;
    background-image: url('images/img01.jpg');
    background-position: right;
    overflow: hidden;
}

The image path is correct. But the image isn't shown. Instead, the background is white? Ughhh how to solve this?

Upvotes: 0

Views: 496

Answers (2)

Someth Victory
Someth Victory

Reputation: 4549

Did you apply this style to a div? if so, you must specify width and height of that div:

#selectTagId{
  background-color: transparent;
  color: white;
  background-image: url('images/img01.jpg');
  background-position: right;
  overflow: hidden;
  width: 200px;
  height: 200px;
}

Upvotes: 0

Bastian Rang
Bastian Rang

Reputation: 2187

For me, it works with an absolute img path. See http://jsfiddle.net/9qf59/2/

Keep in Mind, that relative paths in css can lead to some odd effects. they are relative to the css file, not the document.

Upvotes: 1

Related Questions