Why HTML element's attribute "title" not been named "tooltip"? [closed]
开发者_运维知识库
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questioni think 'tooltip' would be more appropriate
It's named title, because it is the title of an element. In HTML, we describe what things are, not how to display them. I do admit we didn't always do that, but we do it now, or at least should.
This is the same reasoning why to prefer the <em>
tag over <i>
. It's more important to describe the meaning then the display. The display is handled by the browser, and can be tweaked by CSS.
The fact that most browsers display title
as a tooltip should be considered a detail. Good to know of course. But it's not a law; alternative browsers might do different things with it. Classic cases are talking browsers and textual browsers. But an example closer to home is iphone safari. How can you have a tooltip when you don't have a hover? I'm not sure what they do with the title attribute though.
a user agent may choose to implement showing title in statusbar or may not show at all. its up to user agent
Back in the day, the title attribute didn't make a tooltip. It displayed elsewhere, such as in the status bar, or even not at all. Over time the behaviour has become more consistent across browsers making a tooltip.
精彩评论