Let's take a look at how we can write our own custom styles for qTip's tooltips by writing a new purple color scheme:
jquery.qtip.css
file that was included with the qTip download. Here are all the CSS styles that affect the red tooltips:/*! Red tooltip style */ .ui-tooltip-red .ui-tooltip-titlebar, .ui-tooltip-red .ui-tooltip-content{ border-color: #D95252; color: #912323; } .ui-tooltip-red .ui-tooltip-content{ background-color: #F78B83; } .ui-tooltip-red .ui-tooltip-titlebar{ background-color: #F06D65; } .ui-tooltip-red .ui-state-default .ui-tooltip-icon{ background-position: -102px 0; } .ui-tooltip-red .ui-tooltip-icon{ border-color: #D95252; } .ui-tooltip-red .ui-tooltip-titlebar .ui-state-hover{ border-color: #D95252; }
styles.css
file and add these styles:/*! Purple tooltip style */ .ui-tooltip-purple .ui-tooltip-titlebar, .ui-tooltip-purple .ui-tooltip-content{ border-color: #c1c3e6; color: #545aba; } .ui-tooltip-purple .ui-tooltip-content{ background-color: #f1f2fa; } .ui-tooltip-purple .ui-tooltip-titlebar{ background-color: #d9daf0; } .ui-tooltip-purple .ui-state-default .ui-tooltip-icon{ background-position: -102px 0; } .ui-tooltip-purple .ui-tooltip-icon{ border-color: #c1c3e6; } .ui-tooltip-purple .ui-tooltip-titlebar .ui-state-hover{ border-color: #c1c3e6; }
ui-tooltip-purple
class to our tooltips. Open scripts.js
and adjust the classes being added to the tooltips:$('a[title]').qtip({
position: {
my: 'center left',
at: 'center right'
},
style: {
classes: 'ui-tooltip-purple'
}
});
Now, when you preview the link in the browser, you will see a purple tooltip, as shown in the following screenshot:
What just happened?
Using one of the CSS classes provided with qTip, we wrote our own custom style and applied it to our tooltips. You can use any CSS styles you'd like to create a custom appearance for the qTip tooltips. There's virtually no limit to the possibilities for styles when you start mixing in color and font choices, background images, border styles, and so on.
Have a go hero — create a tooltip of your own design
Try writing your own CSS class to style the tooltips. Try a new color scheme, new font styles and sizes, text shadows, box shadows — anything you can think of to make the tooltips match the design of a site or really stand out.
3.12.71.146