tags:

views:

30

answers:

3

Hi,

I basically have the following class:

.sf-sub-indicator {
  background:   url("/abcprod/images/arrows-ffffff.png") no-repeat -10px -100px;
}

Is it possible in CSS to set a background image clause to use a hardcoded symbol such as ">" so that instead it uses:

.sf-sub-indicator {
  background:   url(">") no-repeat -10px -100px;
}

Don't actually want it to use an image but a symbol instead.

Can this be done against a class such as above?

Thanks.

+1  A: 

Short answer, no. You can only set a background to a color or an image.

Zurahn
Thanks. Could you possibly suggest any workarounds?
tonsils
... and the long answer is no longer :)
Andrea Zilio
The only workaround in strictly CSS would be to set the `content` attribute on a DIV to the symbol (repeated however many times you want, as you can't have it repeat endlessly), then absolutely positioning it so that it appears behind the content. Not really a valid method. You'd be better off just making an image of the symbol (which you could do dynamically in PHP using GD). You can also use a .php file as a CSS file, so you could include it right in the CSS file.
Zurahn
Thanks to all for the responses.
tonsils
A: 

I don't think it can be done via url(). inside the bracket should be "url" of image type.

You can do something similar using jquery

$(".sf-sub-indicator").each( function() { $(this).html(">" + $(this).html()) });
iKid
A: 

Long answer: Yes. Sort of.

Your most-popular tag is jQuery, so I won't go in depth with the code, but basically you could find the class:

var div = $(".sf-sub-indicator")

get its dimensions:

var height = div.height()` and `var width = div.width()

Then you could create an absolutely positioned div of that height and width, and place it directly over the original div. Then, making sure that the first div had no background-color, you could give that a higher z-index than the new div.

Lastly, fill the new div with .innerHtml with your character, and set overflow=hidden.

This is a weird request...

Alex Mcp