show alt text instead of img

edited February 2007 in Style Development
Problem: I have an image that looks ugly and I want to display the alt text instead
Is there any way to show the alt text of an img instead of the image itself using css?
Thanks

Comments

  • ok, after a long search I found out how to do it

    img:before {content: attr(alt);}

    but apparently the :before selector doesn't work for images in firefox(bug), so its no use

    just wanted to let you guys know, let me know if anyone finds another way
  • Actually it's not a bug. Per section 12 of the CSS3 Generated and Replaced Content Module replaced elements do not have ::before and ::after psuedo-elements. The only way you'd be able to do it would be some point in the future when Mozilla implemented either content on elements or the ::outside pseudo-element.
Sign In or Register to comment.