Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide alt tag in firefox

As per the default behavior, alt attribute is rendered first time just before the image rendering. I am displaying 25 images in a grid so it looks bit awkward as all alt attributes are displayed first.

Is it possible to hide alt attributes in Firefox?

Note: alt attributes contain dynamic names in my case.

like image 238
neeraj Avatar asked Oct 01 '12 05:10

neeraj


3 Answers

From the reference of all the above answers, I figured out best one is to use

img:-moz-loading {
  visibility: hidden;
}

Suppose there is no image and we use color as white or transparent then alt attribute no more use so, we need this attribute if there is no image to show which image here to load and to show alternative text to display.

like image 123
Vikram Avatar answered Sep 28 '22 16:09

Vikram


After trying all the other methods here, I found this method works best which makes the text transparent until the image loads:

.yourClass img {
    color: transparent;
}
like image 19
user unknown Avatar answered Oct 18 '22 00:10

user unknown


The way to prevent alt attribute values from being displayed is to remove the attribute.

The meaning of an alt attribute (not tag) is that it specifies an alternative, a substitute for the image, in situations where the image is not displayed. So if you want to hide it when the image has not yet been loaded, you are asking for behavior that contradicts the very meaning of the attribute.

You can however make the alt text invisible (with the usual CSS Caveats) on Firefox by setting e.g.

img { background: white; color: white; }

in CSS. This implies that the alt texts are invisible also in case the browser never gets the image, or the browser has been configured not to display images.

like image 13
Jukka K. Korpela Avatar answered Oct 17 '22 22:10

Jukka K. Korpela