MilConDoin
MilConDoin

Reputation: 745

Define Base-URL for img src via CSS

Is it possible to define the base URL used for <img>-tags of a certain class via CSS?

For example my <img>-tag would look like

<img class="switchingURL" src="pic1.png">

Then I'd like a kind of CSS element like:

.switchingURL {base-url: /images/;}

Then if I want another picture set, I'd rewrite it to something like:

.switchingURL {base-url: http://www.tempsite.de/newstyle/images/;}

Does a tag similar to the base-url I used in the examples above exist?

Upvotes: 2

Views: 2471

Answers (1)

Hussein Nazzal
Hussein Nazzal

Reputation: 2557

SEARCH NO MORE , you can not do that with css .

but it's your lucky day , with a simple line of jquery you can do that .

$('img[src=""]').attr("src", "images/someimg.jpg")

the above line searches for empty src and sets it to images/someimg.jpg

Upvotes: 1

Related Questions