Since ASP.NET controls output HTML, is there a particular Doctype that works better with the kind of HTML they're likely to output? Are some Doctypes more flexible than others for this kind of usage?

I'm using C# on the server-side, if that's relevant.

5 answers

danwellman 5600
2
points

You need to use XHTML when using .net because of the attributes it adds to certain elements. Use XHTML doctype in order to validate

Answered about 7 years ago by danwellman
  • ASP.NET controls are no where close to spitting decent HTML, so you are better off using danwellman's suggestion. I use XHTML transitional. Divya Manian about 7 years ago
George 68
1
point

When a new .aspx page is created in Visual Studio it includes the xhtml 1.0 transitional doctype by default. I would stick to that unless you'd rather go with xhtml 1.0 strict.

Answered about 7 years ago by George
0
points

Doctype depends on features you want in HTML.

I use HTML 4.01 strict, but that's just my preference. There is no "optimum".

Answered about 7 years ago by Nathan DeGruchy
Brian 10
0
points

HTML 5

<!DOCTYPE html>
Answered about 7 years ago by Brian
  • don't use HTML 5 as it is experimental and only has the most rudimentary browser support. Chris Sobolewski about 7 years ago
  • Chris is wrong, you can write a site perfectly in HTML5 for IE6 and above: http://articles.sitepoint.com/article/html-5-snapshot-2009/2 I've done it myself for clients. orta about 7 years ago
  • <a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(HTML_5)">Support is spotty at best</a>. If you don't intend to use any of the features of HTML 5, then I suppose you're fine FOR NOW. However, when HTML becomes standard, if you are using any of the changed tags while declaring the HTML 5 doctype, there can be issues : http://www.w3.org/TR/2009/WD-html5-diff-20090825/#changed-elements If you use any of the depreciciated elements, there will definately be issues once HTML 5 becomes standard. Chris Sobolewski about 7 years ago
  • I think the question relates specifically to ASP.NET, which has 'controls' that spit out a particular type of HTML. I wouldn't have thought they'd be HTML5 compliant, but I'm not sure. Matthew Brindley about 7 years ago
Chad 0
0
points

By default, asp.net outputs html that is xhtml transitional compliant. You can adjust this by changing a setting in the web.config.

<system.web>
    <xhtmlConformance mode="Strict" />
</system.web>

For instance will make asp.net spit out xhtml strict code.

Answered about 7 years ago by Chad