As a novice in CSS, I am struggling with implementing a tooltip. The issue regarding focus has been resolved, thanks to realizing a small typo in the code.
I have created a CSS for a tooltip, but I am unsure where to place it and how to ensure it only appears when a textfield is selected.
Check out the Fiddle here: http://jsfiddle.net/v8xUL/274/
.tooltip
{
position: absolute;
padding: 1px 10px;
margin-left: 6px;
background: #06DEE5;
font-size: 12px;
line-height: 20px;
color: #000;
-moz-box-shadow: 2px 2px 3px #444;
-webkit-box-shadow: 2px 2px 3px #444;
box-shadow: 2px 2px 3px #444;
}
The CSS above was extracted using "Inspect element" from a website.
Currently, the tooltip displays even when the textbox is not selected, as shown in this image: . It should only show the message "Please enter name" when the textfield is selected.