XML technologies / CSS / CSS Cookbook / Images / Replacing HTML text with Flash
(Excerpt from “CSS Kochbuch” by Christopher Schmitt)
Problem
Replace HTML text with additional typographic options without having to update static graphics (as discussed in the recipe Replacing HTML text with an image ).
Solution
Use the technique Scalable Inman Flash Replacement (sIFR).
Download the JavaScript file and the other required components from Mike Davidson - sIFR.
Open the file sifr.fla in Flash. Click the white drawing area (“canvas”) to display the properties panel (the drawing area is still empty; see the following figure).
Figure: Displaying the properties panel in Flash.
Now choose a font for your web page’s design (see the next figure).
Figure: Choose a font from the properties panel.
Export the file and name it after the chosen font. For Britanic Bold, the file name would be britanicbold.swf.
The sFIR files also include CSS rules to copy and paste into your site’s CSS files. Make sure these files are available to your site. For example, use the following rule to display the heading in the right font:
h1 {
font-family: "Britanic Bold", Arial, Verdana, sans-serif;
margin: 0 0 .3em 0;
padding: 0 0 .3em 0;
border-bottom: 2px solid #666;
text-align: left;
font-size: 2em;
}To see the result, simply upload the file to your server and open it in a browser, as in the following figure.
Figure: The heading appears in Britanic Bold.
Discussion
In 2004, web developer Shaun Inman invented the method Inman Flash Replacement. With small files and a very direct approach, it replaces HTML text with Flash-based text.
Another web developer, Mike Davidson, used Inman’s method as the basis for a more robust system that also supports resizing text, even across multiple columns.
The sFIR technique is mainly used to replace text in headings and non-text-based links. It can also be used with text-based links, but users can then no longer open them in a new browser window with a right or middle click.
Because this technique relies heavily on JavaScript and Flash, users may feel that sFIR text takes longer to display than normal HTML text.
Modern browsers such as Internet Explorer for Windows, Opera 8+, Safari and Firefox support Flash transparency. However, rendering transparent background images is computationally intensive. Users with slow computers will particularly notice the longer wait.
See also
More information about Shaun Inman’s sFIR technique is available at IFR: REVISITED AND REVISED.
Copyright of the German edition © 2007 by O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “CSS Kochbuch” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstr. 81, 50670 Köln