Results 1 to 4 of 4

Thread: CSS <img> tag

  1. #1

    CSS <img> tag


    I would like to have something similar to this:
    img{ image-source: url(something.gif);}

    So that my images are all pointing to something.gif

    So far I haven't found anything with css that will allow me to change the source of the img tags.

    Can anyone point me in the right direction?

  2. #2
    Join Date
    Dec 2003
    thats not possible with CSS

  3. #3
    Senior Member
    Join Date
    Jan 2002


    AFAIK this is not possible in CSS. But you can use something like this: Instead of &lt;img.. you would have &lt;div class='pic'&gt;&lt;/div&gt; in your html code. And in your css you would have:

    div.pic {background:url('../pictures/thesame.gif' no-repeat top left;

    Of course the height and the width should be set to the height and width of you picutre. In this case you can have as many as you want divs with class pic and all of them with the same picture inside. Other thing is that in this solution no picutre would be seen without css. If this is for your case advantage or disadvanatage is up to you. Good luck.


  4. #4
    Senior Member Zonewalker's Avatar
    Join Date
    Jul 2002
    soda - you don't mean an image as a background do you?

    If you do then use

    {background-image: url("/file path/something.gif")}

    or do you mean images seperated by white space - in which case I'd try something along the lines of Sun's suggestion.
    Quis Custodiet Ipsos Custodes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts