HighDots Forums  

img element: src and alt attributes

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss img element: src and alt attributes in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nzanella@cs.mun.ca
 
Posts: n/a

Default img element: src and alt attributes - 03-18-2005 , 05:33 PM







Hello,

I would like to know whether it is possible to use cascading
style sheet language to set the values of the src and alt
attributes of an img tag. This would come in handy in
situations where you want to display an image in
several places by referencing it by its class
attribute for conciseness.

Please let me know,

Best Regards,

Thanks,

Neil


Reply With Quote
  #2  
Old   
Lars Eighner
 
Posts: n/a

Default Re: img element: src and alt attributes - 03-18-2005 , 06:04 PM






In our last episode,
<1111185226.482808.310950 (AT) l41g2000cwc (DOT) googlegroups.com>,
the lovely and talented nzanella (AT) cs (DOT) mun.ca
broadcast on comp.infosystems.www.authoring.stylesheets:


Quote:
Hello,

I would like to know whether it is possible to use cascading
style sheet language to set the values of the src and alt
attributes of an img tag. This would come in handy in
situations where you want to display an image in
several places by referencing it by its class
attribute for conciseness.
Not really. You can put the image in a stylesheet by making it
the background of a box and simulate an alt text with text in
your document that you hide. And this can actually be sort of
seamless-looking in text browsers.

But what you really want is not to be typing the
IMG tag in over and over. What you want is a preprocessor.
Here is how I enter am image (one I call shortname for this
example) in my preprocessed document:

%getimage(%location,shortname,&pagereg)

This is simpler than that, because I taught my editor a macro
to prompt me for the shortname when I hit meta-q g, and it
writes the line. The preprossor looks up shortname in a
database of images, writes the IMG tag, writes the markup
and caption (if there is a caption in the database) and
records the use of the image in a text file which will be
used by macros in the footer to lookup the photo credit
to put it in the footer and in the stylesheet to look up
height, width, and any special styles for the image. Naturally
the footer gets preprocessed after the body of the document,
and the only tricky thing is to be sure the stylesheet is
in the Makefile *after* the document.

%location is a variable I set at the top of every document
that says where the document is. The %getimage preprocessor
macro then will get the path in the IMG src attribute right
no matter what directory the document is in.

Quote:
Please let me know,
Preprocessor.


--
Lars Eighner eighner (AT) io (DOT) com http://www.larseighner.com/
Nobody home but the lights, and they're out too.


Reply With Quote
  #3  
Old   
Stan Brown
 
Posts: n/a

Default Re: img element: src and alt attributes - 03-19-2005 , 10:26 AM



"" wrote in comp.infosystems.www.authoring.stylesheets:
Quote:
I would like to know whether it is possible to use cascading
style sheet language to set the values of the src and alt
attributes of an img tag.
CSS doesn?t _do_ anything. The first and most important lesson to
larn about CSS is that it is not a scripting language and can?t be
used to alter Web pages.

--

Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.