开发者

Not working Title attribute for image tag?

开发者 https://www.devze.com 2023-03-15 10:40 出处:网络
I am facing bit strange problem with my application. I have an image <img title=\"New (Alt+N)\" alt=\"New (Alt+N)\" src=\"images/icon_new.gif\" tabindex=\"-1\" id=\"Ax14490_image\">

I am facing bit strange problem with my application. I have an image

<img title="New (Alt+N)" alt="New (Alt+N)" src="images/icon_new.gif" tabindex="-1" id="Ax14490_image">

This code is found inspecting document withfirebug.

which is displaying properly but title is not coming on mouseover of that image. can any one help 开发者_开发技巧me out in this context.

I am using firefox 4.0 browser


In case anyone else finds this thread via a search, I was having the same problem as described by the original poster. Here's what turned out to be the cause, in my case.

My layout involved two div objects placed horizontally next to one another. One on the left, and the other on the right. The left div was set to have a width of 100%, although it's contents did not cover all of that space due to internal padding. the right div contained the img which was not triggering any mouse events (including the "title" attribute not working, but onMouseOver and onMouseOut also did not work.)

So this was due to z-ordering. The mouse events were instead being handled by the div object on the left, because it's 100% width encompassed the full browser window. Since the left div had a "position" attribute of "absolute", it could legally have it's z-value set, and so I set its z-value to "-1". This fixed the issue.


Yes, it works for me too.

However, here is a useful guide to the correct usage of both the alt and title tags:

http://www.456bereastreet.com/archive/200412/the_alt_and_title_attributes/


Too Late..But Try This...This is working for me

<img src="images/icon_new.gif" title="New (Alt+N)" tabindex="-1" id="Ax14490_image">

src tag at the first. Thanks


I know I'm way late to the party but things are radically different today (Dec. 2018) than they were when this post was created (Jun. 2011).

In case someone is having this problem with images not showing the tooltip of the title="" attribute, well, make sure you are not testing in Responsive Mode.

The title="" attribute obviously isn't going to work because Responsive Mode in browsers, at least in Firefox and Chrome, emulate touchscreen devices and the title="" attribute only works with a mouse pointer.

Yep, I know what you're thinking…

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号