Help - Search - Members - Calendar
Full Version: printer style sheets & image alt
Invision Power Services > Community Forums > Community Web Design and Coding
Stephen
any idea if there is any CSS I can use so that an image displays its alt text instead of the actual image?
Brendon Koz
I did a quick search and found nothing that could do this, at least within the domain of CSS. I believe you could use JavaScript, or perhaps even switch it with PHP depending on the headers sent to the server.

Although CSS is for presentation purposes, I don't believe they ever really thought of that aspect of HTML is presentation.

On another note...does anyone know how to create Microsoft Office Word style pages using CSS during a print job? i.e.: Force tables to the next page, add page headers/footers with numbering, etc...? I've been trying to figure out a way to set margins and such with CSS that would force an overflow type of thing so that text or images could not be cut off, but I don't think I know how to accomplish it...even with PHP.
Stephen
Javascript can't modify media specific stylesheets, it will just modify the screen display sheet and using a server side technology defeats the purpose because it would mean having to "reload" a printer friendly page instead
Brendon Koz
Ah, I didn't completely understand the purpose you were trying to achieve. My apologies.


-edit-
I found this just now.
Michael K.
I tried using:

CODE
img { display: none; }
img:before { content: attr(alt); }


But apparently :before/:after don't work for images.
Stephen
already read that article malikyte it doesn't say anything about images other than hiding them but thanks anyway

Gornakle, apparently it should work but there is a bug in firefox. Don't think IE supports it either sad.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.