简体   繁体   English

跨浏览器HTML工具提示的Alt或title属性?

[英]Alt or title attribute for Cross-browser HTML tooltip?

I'm looking for a cross browser solution to display information when "hovering" on an element, I know this can be done with JS dynamically but I'd prefer in this specific case a basic static HTML solution. 我正在寻找一个跨浏览器的解决方案来在“悬停”元素时显示信息,我知道这可以用JS动态完成,但我更喜欢在这个特定的情况下一个基本的静态HTML解决方案。

According to mozilla developers website ( here ) using title instead of alt is the best practice but I'd like more "field experience" to help me decide if I should go for ALT , TITLE attr or JavaScript 根据mozilla开发者网站( 这里 )使用title而不是alt是最好的做法,但我想要更多的“现场经验”来帮助我决定是否应该选择ALTTITLE attr或JavaScript

Thank you very much 非常感谢你

Title attribute is for tooltips and is supported by all major browser. Title属性用于工具提示,并受所有主要浏览器支持。 You should use it. 你应该使用它。

Alt attribute isn't about tooltips at all. Alt属性根本不是工具提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM