Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Image SRC in CSS?

Posted on 2003-12-01
4
Medium Priority
?
713 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 100 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

824 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