Lan*_*ins 41 html5 tooltip css3
我正在使用CSS.Tooltips库来尝试获取工具提示以显示输入标记.我可以让它在ap标签上工作但不是输入标签.有任何想法吗?
这里是小提琴的链接:http://jsfiddle.net/cwlanca/BumU5/1/
HTML
<p data-tip="This is the text of the tooltip">This is a paragraph of text that has a tooltip.</p>
</br>
</br>
</br>
<input data-tip="This is the text of the tooltip" value="44"/>
Run Code Online (Sandbox Code Playgroud)
CSS
[data-tip] {
position:relative;
}
[data-tip]:before {
content:'';
/* hides the tooltip when not hovered */
display:none;
content:'';
display:none;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #1a1a1a;
position:absolute;
top:30px;
left:35px;
z-index:8;
font-size:0;
line-height:0;
width:0;
height:0;
position:absolute;
top:30px;
left:35px;
z-index:8;
font-size:0;
line-height:0;
width:0;
height:0;
}
[data-tip]:after {
display:none;
content:attr(data-tip);
position:absolute;
top:35px;
left:0px;
padding:5px 8px;
background:#1a1a1a;
color:#fff;
z-index:9;
font-size: 0.75em;
height:18px;
line-height:18px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
white-space:nowrap;
word-wrap:normal;
}
[data-tip]:hover:before,
[data-tip]:hover:after {
display:block;
}
Run Code Online (Sandbox Code Playgroud)
use*_*353 130
我知道这是关于CSS.Tooltips库的问题.但是,对于其他任何人来到谷歌搜索"工具提示输入框",就像我一样,这里是最简单的方法:
<input title="This is the text of the tooltip" value="44"/>
Run Code Online (Sandbox Code Playgroud)
Jus*_*ard 40
它似乎是一个错误,它适用于非文本框的所有输入类型(复选框,无线电,...)
有一个快速的解决方法可行.
<div data-tip="This is the text of the tooltip2">
<input type="text" name="test" value="44"/>
</div>
Run Code Online (Sandbox Code Playgroud)
<input type="name" placeholder="First Name" title="First Name" />
Run Code Online (Sandbox Code Playgroud)
title="First Name"解决了我的问题。它与引导程序一起使用。