This goes against the idea of structural markup (the extra div add's has no meaning). So why is it rendered? I can only gues this is because of a ASP.NET dependancy of some sort?
Please let me know, because I realy like this project!
It is not an ASP.Net dependency. The DIVs do have meaning -- they define boundaries of a block of markup, and the block of markup is the code generated by the ASP.Net control. They have purpose, too -- you can easily use DIVs to better facilitate using JavaScript
and CSS.
Take two examples -- one where the <table /> created by a GridView has no <div /> wrapper, and one that does not. Now let's say you want to style
only those tables which are created by an ASP.Net GridView. Without the wrapper, you would define a CSS class, and assign it to each GridView using the CssClass property. With the wrapper, you can define it all in CSS, saving a step and (arguably) avoiding
the potential mistake of forgetting to assign the CssClass property.
In other words, wrappers make you do this:
div.AspNet-GridView table {
...
}
... as opposed to this:
table.myTableClass {
...
}
Maybe it's a matter of personal preference, but the wrapper lets you do both, and is far from being "wrong" from an XHTML perspective.
From the structural markup point of view, an element should have an id or class to descripbe their content and/or function. The fact ASP.NET rendered this markup does none of these.
When a developer/webdesigner needs an extra hook to attach something (being javascript or css), there is always the posibility to manualy add an id, class or wrapper-div. Extra markup will only decrease readability and increase filesize.
The fact that this bothers me is that the CSS Friendly adapters realy improves ASP.NET's markup, and this looks like a step in the oposite direction.
chrvanleeuwe
0 Points
2 Posts
Wrapper div
Apr 20, 2007 07:27 AM|LINK
Why do the CSS Friendly adapter introduce a wrapper-div?
This goes against the idea of structural markup (the extra div add's has no meaning). So why is it rendered? I can only gues this is because of a ASP.NET dependancy of some sort?
Please let me know, because I realy like this project!
bdemarzo
Member
435 Points
168 Posts
Re: Wrapper div
Apr 20, 2007 01:01 PM|LINK
It is not an ASP.Net dependency. The DIVs do have meaning -- they define boundaries of a block of markup, and the block of markup is the code generated by the ASP.Net control. They have purpose, too -- you can easily use DIVs to better facilitate using JavaScript and CSS.
Take two examples -- one where the <table /> created by a GridView has no <div /> wrapper, and one that does not. Now let's say you want to style only those tables which are created by an ASP.Net GridView. Without the wrapper, you would define a CSS class, and assign it to each GridView using the CssClass property. With the wrapper, you can define it all in CSS, saving a step and (arguably) avoiding the potential mistake of forgetting to assign the CssClass property.
In other words, wrappers make you do this:
div.AspNet-GridView table { ... }... as opposed to this:
Maybe it's a matter of personal preference, but the wrapper lets you do both, and is far from being "wrong" from an XHTML perspective.
Hope this helps!
- blog: www.sidesofmarch.com
chrvanleeuwe
0 Points
2 Posts
Re: Wrapper div
Apr 20, 2007 03:03 PM|LINK
Thanks for you quick reply brian!
From the structural markup point of view, an element should have an id or class to descripbe their content and/or function. The fact ASP.NET rendered this markup does none of these.
When a developer/webdesigner needs an extra hook to attach something (being javascript or css), there is always the posibility to manualy add an id, class or wrapper-div. Extra markup will only decrease readability and increase filesize.
The fact that this bothers me is that the CSS Friendly adapters realy improves ASP.NET's markup, and this looks like a step in the oposite direction.
bdemarzo
Member
435 Points
168 Posts
Re: Wrapper div
Apr 20, 2007 04:12 PM|LINK
- blog: www.sidesofmarch.com