Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS and ALT attribute

Status
Not open for further replies.

GUJUm0deL

Programmer
Jan 16, 2001
3,676
US
Hey all, I use CSS to display the banners on my work site, and now i'd like to use the ALT attribute in the <style>, how can I do that with CSS?

This is my code:
Code:
<div id="PageBannerContainer">
	<div id="PageBanner" style="height: 125px; background: transparent url(/images/page_banner_home_01.jpg) no-repeat; text-indent: 0px;">BLAH BLAH</div>	
</div>

____________________________________
Just Imagine.
 
The <img> tag has the ALT attribute, like: <img src="a.jpg" alt="Some ALT name here">, i'd like to use the same ALT attribute when I load my images using CSS. Is that doable?


____________________________________
Just Imagine.
 
doesn't make any sense. alt is alternative text for people who can't display images on their screen. CSS styles stuff.

you can't put an ALT definition in your CSS.

i did a quick test to see if the CSS would affect the alt that displays, and it only sort-of does. i was able to change the font family and the color, even though i entered css to change the text-transform, font-size, font-weight.



*cLFlaVA
----------------------------
[tt]mr. pibb + red vines = crazy delicious![/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Excellent question. Essentially you can't. Css doesn't allow for an 'alt' tag combined with background images. See discussion at Alt text for CSS background images

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top