简体   繁体   中英

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.

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

Thank you very much

Title attribute is for tooltips and is supported by all major browser. You should use it.

Alt attribute isn't about tooltips at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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