Posts
293
Comments
27
Trackbacks
206
CSS Woes
There are still too many CSS issues with ASP.NET 2.0; the designer goes loopy occasionally when you have a completely CSS based layout,and the controls also exhibit weirdness. For example, why, when I add a CssClass to an asp:CheckBox, does it wrap the checkbox within a span? Maybe there's some esoteric reason for this, but when pondering why my CSS isn't being applied I have to View Source to find out what the heck is going on. It's a task I should have to do. Becuse of this I've started using server based HTML controls in certain cases, just so I can guarantee what the HTML will be. One thing that needs to happen is for this sort of thing to be documented. I'm going to raise a bug about this as it just annoys me. It's not the fact it does it (well, it is partly), but that fact that there seems to be no sense as to why and certainly no explanation.
[Listening to: In the Wee Small Hours of the Morning - Ed Thigpen - The Trio [Verve]]
posted on Wednesday, June 01, 2005 8:12 PM Print
Comments
# RE: CSS Woes
James.ToString()
6/2/2005 11:56 AM
# More ASP.NET 2.0 and CSS Woes
writerus drivelus
7/3/2005 2:06 PM
 re: CSS Woes
Rob Williams
10/28/2005 11:08 AM
One of the styling guys at my current contract came to me asking about this today so I had a little google and found your post. After a little thinking and a small dig about in Reflector I realised that there is a valid reason for the class being applied to a span...

The Checkbox control has a Text property which renders a label next to the Checkbox on the screen. now if you wanted to color this red it would seem perfectly natural to apply the CssClass to the Checkbox control and have the styling applied to the text as well...

Do I use the Text property? Well no, because it doesn't render an HTML label, but that is another issue altogether ;P

A quick scan of the framework docs revealed no mention of styling checkboxes and that cssclass would be applied to a span to accomadate the Text property, mainly because the CssClass property is inherited from Web Control so the docs are written at that level and not specialised for Checkbox.
# More ASP.NET 2.0 and CSS Woes
Dave Sussman
5/16/2006 5:58 PM
Some time ago I moaned about CSS based designs and the output ASP.NET 2.0 controls render. I've just...
Comments have been closed on this topic.