简体   繁体   English

EmberJS和CSS:空标题的跨度标题工具提示

[英]EmberJS & CSS: Span title tooltip for empty text

I am using 我在用

<span title="Tooltip Text">Hover here</span>

to create a simple tooltip with EmberJS's handlebar templates. 使用EmberJS的车把模板创建一个简单的工具提示。

The text within the span element is dynamic and keeps changing. span元素中的文本是动态的,并且会不断变化。

For example, 例如,

<span title="Tooltip Text"></span>

appears sometimes as a result. 结果有时会出现。

But, it isn't rendering when the innerText is empty, and the tooltip doesn't appear when the innertext is empty. 但是,当innerText为空时,它不会呈现;当innertext为空时,工具提示不会出现。 My requirement is to create a tooltip even if there is no inner text in the span element. 我的要求是即使span元素中没有内部文本,也要创建一个工具提示。

Is it possible? 可能吗?

Well, it seems unlikely that you would want a tooltip to show while nothing is in it, and that's probably why the tooltip doesn't show at all by default when it has nothing. 好吧,您似乎不太希望在没有内容的情况下显示工具提示,这可能就是为什么在没有内容时默认情况下根本不显示工具提示的原因。

Considering you want it to show regardless, have you tried defaulting it to a ' 考虑到您希望它无论如何显示,您是否尝试将其默认设置为“ ' (space)? ' (空间)?

That might do it. 那可能会做到。

You could try the "Braille Pattern Blank" , which is an invisible, non-whitespace character that has worked for me: 您可以尝试“盲文模式空白” ,它是对我有用的不可见的非空白字符:

 div { background-color:#efefef; } 
 <div title="hey">⠀</div><!-- “⠀” (U+2800) --> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM