CSS 悬停在不处理图像后?
I have made a fiddle: http://jsfiddle.net/ATdRD/
Can anyone fix this or spot why this isn't working??
When the user hovers over the image I'd like for the data-title to appear for which i can style like a tooltip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你将它包装在
p
标签中并给它一些定位,它就会起作用:CSS
示例: http://jsfiddle.net/ATdRD/2/
从语义上讲,最好将其放在
div
中或figure
标签,如@BoltClock 提到过。It works if you wrap it in a
p
tag and give it some positioning:CSS
Example: http://jsfiddle.net/ATdRD/2/
Semantically, it would probably be better to place it inside a
div
or afigure
tag, as @BoltClock mentioned.事实证明,大多数浏览器根本不支持
标记上的
:after
。 (显然 Opera 支持它,但除此之外)我可以给您的最佳解决方案是将您的
包装在
中,或者类似,并在其上放置
:after
,或者完全放弃标签并使用
background-image
代替。我找到了这个网站 - http://lildude.co.uk/after- css-property-for-img-tag - 这也可能对你有帮助。
Turns out that
:after
on an<img>
tag simply isn't supported by most browsers. (apparently it is supported by Opera, but not much else)The best solution I can give you is to either wrap your
<img>
in a<div>
or similar, and put the:after
on that, or abandon the<img>
tag entirely and use abackground-image
instead.I found this site - http://lildude.co.uk/after-css-property-for-img-tag - which may help you too.
<代码>:&之后:before 不适用于
replaced
元素,例如img
、input
、button
检查此 http://reference.sitepoint.com/css/replacedelements
所以,你必须定义
non -替换之前的
元素像这样的img
标签http://sixrevisions.com /css/snazzy-hover-effects-using-css/
:after & :before
are not work onreplaced
elements likeimg
,input
,button
check this http://reference.sitepoint.com/css/replacedelements
So, you have to define
non-replace
element beforeimg
tag like thishttp://sixrevisions.com/css/snazzy-hover-effects-using-css/