Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  21] [ 6]  / answers: 1 / hits: 44285  / 11 Years ago, fri, january 17, 2014, 12:00:00

I have an input text box, on which I would like to display some text area when the user's mouse get over it, giving to him informations on the text to enter.
here is my HTML code :



<html>
<body>
<style type=text/css>
.mouseover
{



}

</style>
<span onmouseover=this.classname='mouseover' onmouseout=this.classename=''></span>
<input id=mybox type=text />

</body>
</html>


What is the best CSS trick that would help to do that ?
Thank you for help in advance.


More From » html

 Answers
24

You can do all of this with CSS. Play around with CSS triangles for the tooltip but what you're mainly looking for is to use the :hover pseudo-class. No need for Javascript.



.input {
position: relative;
}

.tooltip {
display: none;
padding: 10px;
}

.input:hover .tooltip {
background: blue;
border-radius: 3px;
bottom: -60px;
color: white;
display: inline;
height: 30px;
left: 0;
line-height: 30px;
position: absolute;
}

.input:hover .tooltip:before {
display: block;
content: ;
position: absolute;
top: -5px;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid blue;
}


http://jsfiddle.net/v8xUL/1/


[#73108] Thursday, January 16, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
josefn

Total Points: 251
Total Questions: 93
Total Answers: 84

Location: Senegal
Member since Fri, Aug 21, 2020
4 Years ago
;