2

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?

1
  • AFAIK, no, but if you know the image size a'priori you can use background-image: url(...) under a generic block element instead. Commented Nov 8, 2013 at 8:57

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.