Odd behavior with CSS in Notes client
Fri 7 Nov 2003, 03:50 PMTweet
by Ben Langhinrichs
I am not sure how to categorize this post, so let's just file it under "Oddities". While preparing for my session on Advanced Notes/Web Coexistence at the UK Admin-Developer Conference, I came across this odd behavior with CSS in the Notes client.
Showing the problem
Here is what I did to cause the problem. I created this very simple CSS in a Style Sheet resource:
and I inserted that StyleSheet resource into the CleanSheet form, which is basically just one big rich text Body field. I then created a table and entered some text into the table. Sure enough, it was in 8pt Verdana.
So far, so good. Next, I highlighted one part of the text and tried to change the font to 12pt Comic Sans MS. I say "tried" because it didn't work. The StyleSheet seemingly takes precedence over even specifically applied text attributes.
Still OK, but not intuitive. But here comes the odd part. Next, I previewed the text in a browser. Guess what? The text that I had entered in the table but not modified was still in 8pt Verdana, but the part I had tried to change was in 12pt Comic Sans MS.
OK, the reason this is stupid is because the IBM developers took a feature from the web, applied it to the Notes client, and made it work only differently in the Notes client even though there is a direct mapping to the web feature. Or to put it another way, they made it not work properly in Notes because the specific attributes should have overridden the style. Instead, the style overrode the specific attributes.
What is the core problem?
There is a "core problem" or really "core difference" between HTML and Notes rich text. In HTML is that there is such a thing as "plain text", or text with no attributes. Just add text to the HTML with no font tags or CSS and you have "plain text". This is not true in Notes. In Notes, all rich text has text attributes. Thus, the CSS can't just apply to unadorned "plain text", because there is no such thing.
How could IBM address this?
One thing they could have done when implementing this is to new font setting called "Default Plain Text". Setting text with this would let it either follow the workstation default settings (similar to how Default Sans Serif and Default Serif work) or follow the CSS, if there was any. This would be an "ideal" solution, but probably not a good solution, as it would be hard to go back and change all the text that should be "plain text".
A more realistic approach which could still be utilized very easily would be that IBM could simply do what they do with the web, which is accept Default Sans Serif 10pt as "plain text". This would be easy to use, as it is already done with the web and would not require changing most existing rich text. Anything in plain 10pt Default Sans Serif would either use the workstation defaults or the CSS. I would recommend IBM do this for ND7, if they have not already for ND6.5 (I haven't tested it yet)
What to do in the meantime?
Be careful if you use this in the Notes client to inform users they should not change the text directly, or at least be aware of the problem so you know what is happening if you get a bug report.
Copyright © 2003 Genii Software Ltd.
What has been said: