I have designed a Stylesheet and embed the stylesheet as resource in a form.I can use some classes that i have defined in the stylesheet for table cells and this works passably (not all styles work).
Can I change the background-color of the form with the stylesheet also?
I’ve tried something, but that has not worked (include a body tag with pass-thru html and applied an id to it) so every tip is appreciately welcome.
Subject: Change background color of a form or page by using a Stylesheet
Use body tag for the style sheet rule, i.e.
body {background-color: }
– Vin
IBM
Subject: I’ve tried it
I’ve tried something like this but it does not work.On top of my form I’ve embedded a Stylesheet.
Below this I wrote the following line (pass-thru html):
The id is set within the stylesheet as follows:
#bgNavigation {color:#000000;background-color:#f00000;}
Only the color works. The background-color not.
I want to use the id because the background-color should differ for some forms.
Subject: Tried it
I assume you’re talking about rendering in Notes client. I tried your scenario in browser, and it rendered correctly.
In your scenario, you’ve tried applying a rule in a style sheet resource using a selector that’s defined in pass-thru html. Style sheet resources are not designed to work with pass-thru html. They’re designed to be applied directly to Notes elements, using the selector corresponding to the Notes element - body selector corresponds to Notes document, div selector corresponds to Notes layer, table selector corresponds to Notes table, and so on.
As you’ve observed, applying style sheet resource to pass-thru html sometimes works. Again, that’s not how style sheet resources are designed to work, and functionality is spotty at best.
To apply style sheet to the document, using body tag will work - body {background-color: }
This does mean thought that forms that have different background colors will need different style sheets.
– Vin
Subject: Style Sheet Resource
I think I’ve understood correctly. You’ve inserted a style sheet resource. The selector in the rule is an id selector. The id the rule is being applied to is defined in the line on the form , which is pass-thru html.
As I’ve said, style sheet resources aren’t designed to be applied to pass-thru html, so defining a rule in a style sheet resource to be applied to something in pass-thru html will not work. In this case, the body id is set in pass-thru html, and thus isn’t recognized by the style sheet resource, and the rule is not applied.
I’m not sure how you did id or class for table cells. The supported way to do it is to set id/class on the table infobox for the table and/or table cell. Then using the id and class selector in the css rule will work because id/class are set directly on the Notes element, the style sheet is applied directly to the Notes element, thus the id/class are recognized and the rule is applied. Unfortunately, there’s no place to set id or class on the form infobox, so this mechanism can’t be used.
The answer to your original question, how to set background-color on form or page using css, is to use the rule
body {background-color: }
in your style sheet resource.
– Vin
Subject: Okay
I see.So unfortunately it is not possible to apply a id or class to a body-tag.
Maybe I can put a table, which has one column and one row, around all other elements of my form and apply the id to the cell.
Subject: Stylesheet resource
Maybe you’ve misunderstood me.I’ve include a stylesheet on top of my form as follows:
Notes Menü → Create\Resource\Insert Resource…\Style Sheets
No usage of pass-thru html.
Below this i’ve wrote the line
I can apply a class or id of my style sheet to some design elements, eg table cells.
This works passably (not every style can be applied).
Why can’t i use a class or id for the body?