Link to home
Create AccountLog in
Avatar of galneweinhaw
galneweinhaw

asked on

Setting img alt tag in CSS
I have a gif icon I am using all over my site... is there a way to put the src and/or alt tags into my class for my img?

ie:

img.my{
       src= ???
       alt=????
}


If it can't be done this way, is there a way to do it?  
I don't want to have to change a million pages if I ever decide to change one of these two thing about the image.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan🇳🇱
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of galneweinhaw
galneweinhaw

ASKER

oooh good idea =)

I'm really liking this whole PHP thing I'm learning...come in very handy!
Avatar of Roonaan
Roonaan🇳🇱
You probably want to have a whole "header.php" / "footer.php" instead of just each image in a single php file.

You could also use javascript, but I find php much cleaner in this type of situations.

-r-
Thanks for the tips.
I already have a header and footer like that.

Not sure why I didn't think of doing it with the image.

I'm just learning php, so I guess I just need to change my mindset a bit now that I have all these sweet tools!
To set src it is possible to use background-image as

background-image: url("...yourUrlHere");



background-image: url("...yourUrlHere");

Open in new window