Macario, I used the pseudo-element :after to build your tooltip. Of course it can be stylized, I just did the least so that when you hover the mouse over the element you need, it appears.
Also had an error in its selector, this using the son rule .ui-icon .ui-icon-pencil instead of .ui-icon.ui-icon-pencil, so he never applied the rule to the correct element.
Thus was the CSS:
.ui-icon.ui-icon-pencil:hover:after,
.ui-icon.ui-icon-pencil:hover::after {
content: attr(data-tooltip);
/* Usei o atributo customizado data-tooltip para colocar uma mensagem no tooltip */
background:yellow;
padding:.5em;
margin-left: 10px;
opacity:.9;
}
In this case the tooltip will appear to the right of the widget. If you want it to stay to the left, use the pseudo-element :before.
I used two notations: :after defined in CSS2, and the notation ::after CSS3. Both are equal, but the ::after was changed to distinguish pseudo-Elements of pseudo-selectors.
HTML is the same, but I added an attribute data-tooltip to customize the tooltip message (this can be generated by your component, when typing Markup):
<span class="ui-icon ui-icon-pencil" data-tooltip="Mensagem">Icon</span>
I created a Jsfiddle to test.
More info take a look at the documentation of the pseudo-elements: https://developer.mozilla.org/en-US/docs/Web/CSS/:after and https://developer.mozilla.org/en-US/docs/Web/CSS/:before.
Macario, could you include the jsf-generated Markup (not facelets/jsp)? In particular, the html of the component you want to add this tooltip to. Using jQuery UI? jQuery UI has a javascript-based tooltip component, I don’t know if it meets your requirement.
– Wakim
@Wakim this is code that the
Chromeshow me, of course this component is inside adatatable. About the tooltip I do not know if it has how to use in this case why of a 1 component it generates me three buttons.– Macario1983