How should we CSS style the messages?

Coordinator
Sep 22, 2008 at 6:37 PM
I'm considering two schemes for implementing CSS styling properties.  Which sounds better to you, if you were using the control?

1)  Define a base CSS class used by both messages and then add both a failure and success class as well.  So, the span would render as either:

<span class="Base Success">Username available</span>

or

<span class="Base Failure">Username unavailable</span>

Your CSS could be something like:

.Base {
  font-family: sans-serif;
  font-size: 12px;
  /* etc etc */
}

  .Success { color: green; }
  .Failure { color: red; }

2) Alternatively, we could define only a success and failure CSS class, so the span would render as either:

<span class="Success">Username available</span>

or

<span class="Failure">Username unavailable</span>

The CSS would be something like:

.Success {
  font-family: sans-serif;
  font-size: 12px;
  /* etc etc */
  color: green;
}

.Failure {
  font-family: sans-serif;
  font-size: 12px;
  /* etc etc */
}

Either way, we could set some sensible default CSS class names that are added to the messages, so that the developer could potentially not have to configure the CSS classes at all.  "Convention over configuration", in most cases, if possible.
Sep 22, 2008 at 7:37 PM
Are you going to support properties like CssClass for the control I mean like,
SucessCssClass and FailureCssClass then give the developer the choice to define those properties or not? And if he didn't define them go with a default configuration for both?
I suggest to implement SucessStyle and FailureStyle with XxxCssClass properties. By default There is apperance properties which can be considered to define Failure Style. Adding new properties to define the Scucess Style would be good. This way the developer has full control.
Coordinator
Sep 22, 2008 at 10:48 PM
Yes, it should definitely allow the developer to specify the class if desired. 

I'd like to also aim for some useful defaults too, so configuration is as optional as possible.
Sep 22, 2008 at 10:54 PM
I think we should have just a CssClass property that would apply to everything and then a SuccessCssClass/FailureCssClass for custom styling when success/failure needs to be different (the first way). CssClass is pretty standard property on .NET controls, so we should follow the naming conventions.