Georg Jansen posted on September 14, 2005 09:17
The work on Log4Net Dashboard is progressing. I had a long sidestep into CSS. I wanted to make the user interface customizable through use of CSS. A lot of work to put all the pieces together, put I finally found out that I needed one style sheet witch is common and one style sheet the user could choose. I finally grasped the meaning of cascading – never actually given it much of a tough.
In the user chosen style sheet I’d put all the colors and font stuff which defines the look. In the common style sheet (mainstyle.css) I have all the other stuff
When I release the Log4Net Dashboard, the different style sheets will be available to view, but to give you an Idea on how I have done this:
In the MainStyle.css I define the basic layout of the menu
.MenuItem
{
padding-right: 0.7em;
padding-left: 0.7em;
height: 1.4em;
vertical-align:bottom;
margin-left: 2px;
}
And in the different style sheets (selectable by users) I, for example, have this definition.
.Menu
{
font-weight: bold;
font-size: x-small;
background-color: darkgray;
}
In runtime the browser will join these two style sheets to form the complete definition of the .Menu element (Cascading).
A also struggle a lot with how to change the style sheet in runtime, based on the value the user had chosen (and which I stored in a cookie).
Actually I found some quiet advanced method on the web (which I didn’t get to work). But the solution which I came up with was simply to have a static method in a utility class (l4ndashutil) and in the aspx page I wrote:
<% Response.Write(L4NDashUtil.StyleSheetRef(); %>
<% Response.Write(L4NDashUtil.StyleSheetRef(); %>
This is almost old style asp syntax, but I had forgotten……..(Sometimes my brain is like a Teflon casserole, nothing sticks to it).