48
The Default Snippets
261
It would be logical to assume that once we’ve added the snippet, everything should
work automatically. However, that’s not the case. Apart from the jQuery UI Widgets
snippets, which we’ll cover later on in this hour, most of the snippets are just start-
ing points for more work. Case in point, the tooltip snippet does nothing unless we
add the
.tooltip
class to some content and create a span to contain the tooltip
itself. If you select the Tooltip with CSS snippet again in the Snippets panel and look
at the description in the bottom of the panel, you see the following instructions: “If
you want to display a tooltip, just add the class ‘tooltip’ to an element and write
your Tooltip Text in a span tag within the element.” So let’s do just that:
1. In Code view, find the beginning
<p>
tag and attach the
.tooltip
class.
2. Still in code view, place your cursor after the word MyKipple.com, insert a
new
<span>
tag, and write The home of my kipple. Then end with the
</span>
tag.
If you click inside Design view to refresh the page, you’ll see that the new tooltip
does not appear. But if you save the page and preview it in your browser, the tooltip
will appear when you hover over any of the text in the paragraph. This is a very
basic demo of the Tooltip with CSS snippet, and the tooltip itself is not particularly
attractive, but it provides you with the building blocks to create advanced tooltips of
your own simply by adding a class and a span tag to an element (think image).
The Default Snippets
The default snippets shipped with Expression Web 4 SP2 provide a wide range of
effects, functions, and options. Depending on the type of snippet, the usage and
application differs. Here, I’ll walk you through the bulk of them and provide you
with the correct method for using them in your own projects.
CSS Snippets
The CSS snippets are divided into three main folders: Action, Effect, and Text. All the
snippets in these folders provide standard CSS markup that can be inserted either in
the head of the HTML page itself (contained within a standard
<style>
block pro-
vided by the Style Block snippet) or in a CSS file or external style sheet. To apply a
CSS snippet to an element on the page, you attach the snippet class to that element.
Keep in mind that a lot of these functions are CSS3, meaning they will not work in
all browsers.
▼
▲
www.it-ebooks.info