简体   繁体   English

如何使用标题 attr-Javascript/CSS 为工具提示添加 css 样式和数据放置属性 =“top”

[英]how to add css style and data-placement property=“top” for tooltips using the title attr- Javascript/CSS

I want to add a tooltip on hover over an icon, I want to it a simple way, I'm adding the title attribute to get the tooltip我想在 hover 上的图标上添加一个工具提示,我想要一个简单的方法,我添加标题属性来获取工具提示

html: html:

<div class="container">
<div class="block">

</div>
  <div class="row">
    <div title="hovered text"data-placement="top" class="tooltiptext">
    
      <span class="tooltips"onmouseover="hover(this)">
   Hola hover</span> 
    </div>
  </div>
    
</div>

http://jsfiddle.net/4sp1ufgn/ http://jsfiddle.net/4sp1ufgn/

however I havent found a way yet to:但是我还没有找到一种方法:

  1. style the tooltip using the title attribute使用 title 属性设置工具提示的样式
  2. the data-placement property does not work on title attribute. data-placement 属性不适用于 title 属性。

even when I have value as "top" for data-placement, it still renders below the text.即使我将值作为数据放置的“顶部”,它仍然呈现在文本下方。 Any idea what would be the fix for the above 2 issues?知道以上两个问题的解决方法是什么吗? Thanks in advance.提前致谢。

You can use the w3schools example, which is written only in HTML and CSS.您可以使用 w3schools 示例,该示例仅在 HTML 和 CSS 中编写。

CSS Tooltip Example CSS 工具提示示例

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

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