这对工具提示有效吗?出于某种原因,我认为在标题字段中添加div是无效的。
<div class="graph_item tooltip" title="
<div id='tooltip_inner_container'>
<div id='title'>Ready Set Cook!</div>
<strong>250 HEALTHY POINTS</strong>
The Goal of Ready, Set, Cook! is to cook and log at least 1 recipe per week for 8 weeks. If you complete this challenge, You will
become eligible for prizes.<br /><br />
Registration:
May 7 - May 14<br />
Duration: May 15 - June 6
</div>
" style="width:100%; height:58px; left:0%; top:0%; background-color:#0073ad; background-image:url(images/a.jpg);">
答案 0 :(得分:2)
是的,您的HTML有效(当然,如果您关闭div
)。
但是,此title
属性的内容是不是(并且不能是)HTML。这是文字。
答案 1 :(得分:1)
也不是有效的XML,不应该将节点放在属性中。
我建议使用像:
这样的HTML<div class="graph_item has-tooltip" style="width:100%; height:58px; left:0%; top:0%; background-color:#0073ad; background-image:url(images/a.jpg);">
<div class="tooltip" id='tooltip_inner_container'>
<div id='title'>Ready Set Cook!</div>
<strong>250 HEALTHY POINTS</strong>
The Goal of Ready, Set, Cook! is to cook and log at least 1 recipe per week for 8 weeks. If you complete this challenge, You will
become eligible for prizes.<br /><br />
Registration:
May 7 - May 14<br />
Duration: May 15 - June 6
</div>
</div>
</div>
作为css: .has-tooltip .tooltip {display:none; } .has-tooltip .tooltip:hover {display:block; }