views:

559

answers:

4

Does Visual Studio 2008 support HTML 5 compliant code generated for browsers?

A: 

The user generates the code by writing it and validating it.

matpol
Do you know what HTML 5 is?
Ravia
doesn't visual studio have the capacity to generate text files if it does it can generate html5 - html is just a text file with the extension html or htm.
matpol
HTML and files with the *.html extension are not synonymous.
Joel Potter
sounds like a great bit of software - tie the developer up with stuff he shouldn't really have a problem with -e.g. writing html
matpol
there's part of me that wants to write something here about separation and this makes life easy when building web sites but I won't.
matpol
+3  A: 

Visual Studio by itself doesn't gerenate much html. This is done by the System.Web .NET code. Visual Studio can validate code that you've written, but not HTML 5 by default. You can let .NET generate HTML5 code for you. In that case you should write your own control adapters. Every ASP.NET control can be extended with an control adapter, just like the ASP.NET team has done with the CSS Friendly Control Adapters.

ASharp
+2  A: 

HTML5 is still a draft, and doesn't have much syntax difference from SGML, but also allows for more XHTML style coding (such as using self-closing tags.)

Last time I checked, Visual Studio 2008 and 2010 produced XHTML compliant code, ie. with proper closed tags. It doesn't have support for canvas and video, but that wasn't your question either, was it now?

So if you're asking how you change the default template for HTML and ASPX files, I don't know. But if you're asking about the designer for HTML and ASPX generates compliant code, then yes, it does.

Addition: I just made a ASP.NET WebApplication in Visual Studio, changed the doctype to <!DOCTYPE html>, and validated the output at http://validator.w3.org/check using the HTML5 validation.

Result: This document was successfully checked as HTML5!

So in short: Yes, VS2008 and VS2010 supports HTML5 out of the box ;-)

Claus Jørgensen
A document that anecdotally validates as HTML5 isn't really the same as a document that generates the new HTML5 elements where appropriate. Put another way: Just because it's not *not* HTML5, doesn't mean it's very good HTML5.
brianary
how did you changed the doctype
Ravia
Using my keyboard!
Claus Jørgensen
+2  A: 

If your concern is over the generated HTML output of ASP.NET Webforms not being compliant, have you considered using ASP.NET MVC?

The benefit is that it allows you to have absolute control over your markup so you can be sure of outputting HTML 5 compliant code.

The cost is that you lose the ASP.NET webcontrols, viewstate things like that. So you have a different set of issues to consider and handle.

TreeUK