Chapter 5. ASP.NET 2.0 CSS Friendly Control Adapters

Up to this point, there has been a fair amount of discussion about the advantages of CSS in your web projects. It can improve accessibility for your users as well as compliance with established web standards. You have seen how to achieve a standard website template resembling the traditional tables-based approach by using only CSS styling. You learned how to lay out the header and footer and how to create a two-column layout for your content. You have learned how to use the tools in Visual Studio 2005 to create and apply your CSS files for your web projects.

But is that enough? What happens, for example, if you drop one of the many ASP.NET controls onto your web project? How will it be rendered in your user's browser? For example, if you use the new GridView that is part of the ASP.NET 2.0 tools, how will the HTML look in the browser?

The answer, quite simply, is that many of the ASP.NET 2.0 controls render with tables. To continue the above example, if you use a GridView in your project and then view the HTML source of the rendered page, you will see that all of the content is done in tables. Is this a bad thing? As with all positions on CSS theology, it depends on whom you ask. Many people, including quite a few CSS enthusiasts, believe that tables are okay to use for tabular data, which is what you are talking about in this GridView example. However, if you want to go with a pure CSS mentality in your projects, this would not ...

Get Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.