Tip

Use computed text to write cross-browser & cross-platform CSS

Annoyed by how Netscape renders a font size differently than Internet Exlorer...or how a Mac renders different from Windows? Domino has a feature no other Web platform offers, computed text! Its easy to fix these browser and platform differences with CSS. Here's how...

Modify your exisitng CSS to use Computed Text where ever the differences occur. (Your CSS will need to be a page or form and not an Image Resource in order to do this.)

Since the prime differences occur in frame spacing and font sizes, I've provided examples for both.

FONT SIZE DIFFERENCES:
Sample CSS:
a { cursor:auto; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight:bold; color: #006}

In this scenario, create computed text to replace the 12px for the font-size. The formula would be:

@If(@BrowserInfo("BrowserType")="Netscape" &
@BrowserInfo("Platform")!="MacOS";"13px";"12px")

*Notice Mac NS renders the same as IE!

*Use pixels instead of point size to make your CSS campatible across platforms. If you wanted to use point sizes, similar code would be:

@If(@BrowserInfo("BrowserType")="Netscape" &
@BrowserInfo("Platform")!="MacOS";"9pt";"8pt")

FRAME ROW AND COLUMN DIFFRENCES:
Since Netscape rounds to the nearest 5 pixels, your frameset may not appear exactly as you like. For instance if the graphic you designed is 80 pixels high, you would like your frame to be as well.

Here's code to help:
Partial Frame HTML:
<FRAMESET FRAMEBORDER=0 BORDER=0 ROWS="76,*">

Replace the 76 with Computed Text:
@If(@BrowserInfo("BrowserType")="Netscape";"80";"76")

*Unfortunately, this means you would not be able to use Domino frames, and you would have to copy the code it usually renders into a page where you can adjust the code as needed.

This was first published in January 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.