is there a way to make title= attribute work on Ch

2020-03-09 07:18发布

<span title="Hover text">Hello World</span>

In Firefox, that will display a tooltip with "Hover text" but in Chrome, you get nothing. Any way to fix this with HTML/CSS or is another scripting language required?

6条回答
趁早两清
2楼-- · 2020-03-09 07:52

title="hover text" is the way chrome works. Are you sure you don't have something else (maybe a div with no content) overtop of the span text?

查看更多
Bombasti
3楼-- · 2020-03-09 07:55

Though this is a really old post i've seen no answer. I've had the same sort problem and for me the problem was that the element was behind another. I've moved it up using z-index and that solved it.

查看更多
▲ chillily
4楼-- · 2020-03-09 07:55

I also had an issue with "title" tooltip defined on a div not showing. In my case it wasn't a browser-specific thing, but I thought I'll post it here anyway...

I solved it by defining a higher z-index.

查看更多
We Are One
5楼-- · 2020-03-09 07:57
<!DOCTYPE html>
<html>
  <body>
    <span title="Hover text">Hello World</span>
  </body>
</html>

works for me

查看更多
Evening l夕情丶
6楼-- · 2020-03-09 07:58

If you come here from Google looking for an answer about glitches in the title attribute using Chromium under linux. Then you can be interested in this bug report which is apparently fixed in latest versions

查看更多
Explosion°爆炸
7楼-- · 2020-03-09 08:06

It works for me with only title.

You should use both alt="Hover text" and title="Hover text"

查看更多
登录 后发表回答