![]() |
. |
If you are viewing this page with MSIE 4.0 or Netscape 4.0, the '3D Text' below should look different than the '2D Text' underneath it. This effect can be done with an image editor, but I used Dynamic HTML here, as an example of what can be done with Dynamic HTML.
2D Text
In this example, I have sepated the Dynamic HTML layers more, and used a greater color range to increase the depth of the '3D Text'.
2D Text
Here, I just switched the Highlight color and the Main color of the '3D Text' to create a different text effect.
2D Text
Finally, so you can see the Dynamic HTML Layers that make up the '3D Text', I have sepated the layers even more. You will notice that the text consists of layers:
Base - this is an invisible layer for positioning.
Shadow - this is the shadow layer of the text, which is drawn first.
Highlight - then a highlighting layer is drawn on top of the shadow.
Text - finally, the main layer of text is drawn on top of the previous 2 layers.
2D Text
Using Dynamic HTML to create 3D Text, is an involved process. Hopefully the process will become easier in the future as Dynamic HTML becomes integrated into tools like FrontPage.
The
first step is to define the styles for the 3 Layers of Text.
On the Format Menu, open the Stylesheet dialog.
You define your 3 styles for Shadow, Highlight and Text, between the style tags as follows:
Here are the styles I defined for my 3D Text, t3dbase, t3dshadow, t3dhighlight and t3dtext, for Base, Shadow, Highlight and Text respectively:
Note: For non-FrontPage users, the Style Tags go in between the Head Tags.
The Parameters that I used for the styles are:
- font-family: the font to be used
- font-size: the size of the font (I used px for pixels)
- color: the color for the font
- z-index: I don't know if this makes much difference, but it indicates which drawing layer should be used
- position: positioning, relative for the Base layer, and absolute for the other layers.
- top: this is the positioning for the top of the line of text (vertical offset)
- left: this is the positioning for the left of the line of text (horizontal offset)
The
next step is to define a single cell table to put your text in. Dynamic HTML works on the
current HTML element. So by creating a single cell table, you are isolating the Dynamic
HTML, so the positioning is relative only to the text in the cell.
. |
Position
your cursor within the table, then switch FrontPage to the HTML view. Copy and paste (or
type) the following code between the Cell tags (td.../td), replacing the '3D Text' code,
with the text that you want:
To support browsers, that do not recognize Dynamic HTML, I have enclosed the code in a JavaScript routine:
The code inside the noscript tags is for non-javascript browsers, and is just a normal HTML line for the text:
Inside the JavaScript routine, I first check for a version 4.0 browser:
if (navigator.appVersion.substring(0,1) >= 4) { . . . } else ...;
The code after the else, is for JavaScript browsers, that are below version 4, I use the document.write() method, to output HTML for those browsers:
document.write(" 3D Text
");Or a simplified version, without the font tag:
document.write(" 3D Text
");
In the main body of the IF, I use the document.write() method to output the Dynamic HTML:
if (navigator.appVersion.substring(0,1) >= 4) { document.write(" "); document.write("3D Text"); document.write("3D Text"); document.write("3D Text"); document.write("
"); }
The actual Dynamic HTML Code is:
3D Text 3D Text 3D Text
The whole Dynamic HTML element is enclosed in a Paragraph (p ... /p) tag, this is also the base layer (class=t3base) and contains a single space ( ). Each displayed layer is a SPAN element within the Paragraph, using the class for the layer. I have also used Header (h1...h3) elements as the base layer, so there probably other elements that will work also.
Playing
around is the best way to find out what works. If anyone finds some good documentation on
this, please let me know. I got most of my information from the W3C Organization at: http://www.w3.org/TR/REC-CSS1 and http://www.w3.org/TR/WD-positioning
I have included these examples of my Style definitions, so that you can get an idea of how to adjust the settings.
[Home] [ScrapBook]
[Chat]
[Links]
[Contact]
[FrontPage]
This page hosted by Get your own Free Home Page
JES - 03/28/98