Technical Discussion
  >> Web Design / HTML / Web hosting Forum


Register (or login) on our website and you will not see this ad.


  Print Thread
Standard User think26872
(committed) Sat 13-Aug-11 17:46:12
Print Post

CSS Help (Reusing Image Tags <img>?)


[link to this post]
 
A site uses the following in the HTML:

<img src="longpath_1.gif" .....>
<img src="longpath_2.gif" .....>
<img src="longpath_3.gif" .....>

Can the above be changed to use CSS like:

<img class="1">
<img class="2">
<img class="3">

Where class includes the src / width / height / title / alt (or at least src) in the CSS instead?

Thanks
Standard User camieabz
(sensei) Sat 13-Aug-11 18:02:55
Print Post

Re: CSS Help (Reusing Image Tags <img>?)


[re: think26872] [link to this post]
 
Kind of. You can't use "1" as a class iirc. You have to give it a more identifiable name.

~~~~~~~~~~


© Camieabz 2002-2011

Live BQM ~ Connection Data
Standard User 12eason
(eat-sleep-adslguide) Sat 13-Aug-11 18:14:11
Print Post

Re: CSS Help (Reusing Image Tags <img>?)


[re: camieabz] [link to this post]
 
Can't start with a number.

___________________________________________________________________
           Firenet - V21 - Fast4 - f·2·s - eclipseinternet - entanet - aaisp.net -


Register (or login) on our website and you will not see this ad.

Standard User think26872
(committed) Sat 13-Aug-11 20:48:30
Print Post

Re: CSS Help (Reusing Image Tags <img>?)


[re: camieabz] [link to this post]
 
Thanks, I thought it would be possible any pointers?
Standard User 12eason
(eat-sleep-adslguide) Sat 13-Aug-11 20:51:37
Print Post

Re: CSS Help (Reusing Image Tags <img>?)


[re: think26872] [link to this post]
 
OP: title, src and alt are not things that should be done with CSS, but width, height, positioning etc are. HTML deals with the content, CSS deals with style and formatting.

The reason it is set up like that it because content is specific to each element, whereas the same formatting and style can be applied to multiple elements.

___________________________________________________________________
           Firenet - V21 - Fast4 - f·2·s - eclipseinternet - entanet - aaisp.net -
Standard User 12eason
(eat-sleep-adslguide) Sat 13-Aug-11 20:55:16
Print Post

Re: CSS Help (Reusing Image Tags <img>?)


[re: 12eason] [link to this post]
 
You can however use CSS for background images for other block elements like div, p etc. But you'll have to be specific if you only want one image, so use id rather than class.

___________________________________________________________________
           Firenet - V21 - Fast4 - f·2·s - eclipseinternet - entanet - aaisp.net -
Standard User camieabz
(sensei) Sat 13-Aug-11 21:28:49
Print Post

Re: CSS Help (Reusing Image Tags <img>?)


[re: think26872] [link to this post]
 
In reply to a post by think26872:
Thanks, I thought it would be possible any pointers?


PM'ed

~~~~~~~~~~


© Camieabz 2002-2011

Live BQM ~ Connection Data
Standard User 12eason
(eat-sleep-adslguide) Sat 13-Aug-11 22:14:02
Print Post

Re: CSS Help (Reusing Image Tags <img>?)


[re: camieabz] [link to this post]
 
In reply to a post by camieabz:
PM'ed
Sensible.

___________________________________________________________________
           Firenet - V21 - Fast4 - f·2·s - eclipseinternet - entanet - aaisp.net -
  Print Thread

Jump to