2013-06-18 57 views
1

这是否适用于工具提示?出于某种原因,我认为在标题栏中添加div是无效的。将title标签放在title =“”字段中

<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);"> 
+1

为什么不应该允许它? – bwoebi

+2

你可以做到这一点,但不要指望html显示在显示标题文本的小弹出窗口中。 – scrappedcola

+2

它不会做你想要的东西 - 它不会显示为“div”。它只是将整块作为文本。看[这个jsFiddle](http://jsfiddle.net/77rah/)。 – iamnotmaynard

回答

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: 。先后-工具提示.tooltip {显示:无; } .has-tooltip .tooltip:hover {display:block; }

+0

这是一个正常的字符串?只是几个< and > – bwoebi

+0

如果你使用jQuery工具提示,但它很好吗?或者最好只在标题字段中使用文本? – Christina

+0

属性不是一个有效的xml节点容器,你无法预测浏览器如何处理它,如果需要更复杂的文本作为工具提示,我会使用jquery工具提示解决方案 – Edorka

2

是的,你的HTML是有效的(如果你关闭div,当然)。

但是,此title属性的内容是而不是(而且不能是)HTML。这是文字。

enter image description here

相关问题