Solved

Image SRC in CSS?

Posted on 2003-12-01
4
707 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
styling bootstrap grid system with CSS 2 48
Javascript 2 37
Change how page is organized 3 35
Can't change Woocommerce checkout select boxes, white on white text. 1 27
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

740 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