28 June 2009

HTML and CSS for ASP.NET Developers:
Part One, Introductory Whining

About the series

This is a series about basic HTML and CSS knowledge. It is written for those of you who have experience with ASP.NET Web Forms, but feel your knowledge of HTML/CSS has fallen behind.

I work as an ASP.NET web developer, but I differ from most other ASP.NET web developers I've met in one regard: I put a lot of emphasis on HTML/CSS. To me web client code is king, but why is it neglected by so many ASP.NET developers? I think the answer is ASP.NET Web Forms.

When I began my .NET programming career I already knew some HTML and CSS, and I instantly felt Web Forms didn't play well with—what I think is—good HTML/CSS coding practice. It felt like listening to a well known song on a badly tuned guitar, played by a self-willed bully in his own odd way. But I earned a living using ASP.NET and simply had to play the badly tuned guitar.

By design Web Forms acts as an abstraction layer between server and client code. I find the generated client code horrible and it's not compatible with my mindset. Therefore it has been a source of frustration to me. But to others it has been a blessing since they didn't need to bother with the client side. That's the reason Web Forms have alienated some ASP.NET developers from the web client.

Hiding behind Web Forms might have been an acceptable strategy before, but if you want to keep up with the rest of the world you have to tame Web Forms and take control of the client code. And eventually I believe you'll need to throw Web Forms away and learn something different like ASP.NET MVC.

But enough complaining. The reason I started to write this series was not to whine, but to teach my way of compromising between writing elegant client code and using Web Forms. I'll not cover JavaScript, but once you've learnt the principles below, you'll have an excellent foundation to use together with e.g. jQuery.

Next part will be about semantic HTML. If you want to prepare yourself, this would be a great article to start with: Semantics—Why Bother?

No comments:

Post a Comment