Solved

Image SRC in CSS?

Posted on 2003-12-01
4
706 Views
Last Modified: 2013-11-19
Is there a way I can define the SRC of an Image tag in CSS?

Please note:
I have already tried using the background-image property, but it doesn't solve the fact that I don't declare the src and thereby shows an image marker in IE for the placeholder with the correct image in the background... thus not a good solution.
0
Comment
Question by:yleviel
  • 2
4 Comments
 
LVL 31

Expert Comment

by:seanpowell
ID: 9853484
>>but it doesn't solve the fact that I don't declare the src

You can't have an image if you don't declare the source, CSS or otherwise...
0
 
LVL 15

Accepted Solution

by:
Timbo87 earned 25 total points
ID: 9853538
You can set the properties of the image with CSS, but you cannot specify the src with CSS.

<img style="border:0;width:300px;height:200px" src="mypic.jpg">

If you need to change the src in the life of the document you could do that with JavaScript.
0
 
LVL 2

Author Comment

by:yleviel
ID: 9853606
the whole point is to allow a user to define their own images in a single sheet rather then having to find and replace each case.
0
 
LVL 15

Expert Comment

by:Timbo87
ID: 9853657
You could have the user set custom images with cookies.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question