【发布时间】:2016-07-16 11:59:26
【问题描述】:
我想为 tooltip 制作一个自定义 CSS 类,它将包裹长度超过 25-30 的字符串。通常这么长的文本不适合 tootltip 文本区域。
还有没有办法使用 Tooltip (ui.bootstrap.tooltip) 做到这一点? 就像使用自定义 CSS 类来获得所需的输出一样。
这是简单的 CSS 工具提示 - Plunker DEMO
这是相同的代码片段:
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
max-width:100px;
padding:15px;
min-height:30px;
background:#fff;
visibility: hidden;
border: 1px solid black;
color: #000;
text-align: center;
border-radius: 6px;
/* Position the tooltip */
position: absolute;
z-index: 1;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
<body style="text-align:center;">
<p>Move the mouse over the text below:</p>
<div class="tooltip">Hover over me 1
<span class="tooltiptext">Tooltip text</span>
</div>
<div class="tooltip">Hover over me 2
<span class="tooltiptext">Array [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,,1,11,1,1,1,11,1,,1,1,1,1,1,1,1,1,1,1,1,1,1,1]</span>
</div>
</body>
【问题讨论】:
-
你需要向我们展示你到目前为止所做的事情。
-
@Satej 这里是演示plnkr.co/edit/qhnkkTNfl9i7zu7aMXFJ?p=preview
-
是的,正确。 @satej
-
已将其作为答案发布,如果符合您的要求,请选择作为答案。
标签: html css tooltip angular-bootstrap