Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alt or title attribute for Cross-browser HTML tooltip?

Tags:

html

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

like image 707
danie7L T Avatar asked Jan 14 '23 16:01

danie7L T


1 Answers

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

Alt attribute isn't about tooltips at all.

like image 72
Pavel Strakhov Avatar answered Jan 28 '23 00:01

Pavel Strakhov