在 Firefox 中隐藏 alt 标签 [英] hide alt tag in firefox

查看:45
本文介绍了在 Firefox 中隐藏 alt 标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据默认行为,alt 属性在图像渲染之前第一次渲染.我在一个网格中显示 25 张图像,所以它看起来有点尴尬,因为所有 alt 属性都首先显示.

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.

是否可以在 Firefox 中隐藏 alt 属性?

Is it possible to hide alt attributes in Firefox?

注意: alt 属性在我的例子中包含动态名称.

Note: alt attributes contain dynamic names in my case.

推荐答案

防止alt属性值显示的方法是移除该属性.

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

alt 属性(不是标记)的含义是它指定了一个替代,即在图像未显示的情况下的替代品.因此,如果您想在图像尚未加载时隐藏它,则您要求的行为与该属性的含义相矛盾.

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; }

在 CSS 中.这意味着 alt 文本也是不可见的,以防浏览器永远无法获取图像,或者浏览器已配置为不显示图像.

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.

这篇关于在 Firefox 中隐藏 alt 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆