你可以继续使用XHTML语法,如果你愿意的话。就CSS而言,我没有意识到不同的文档类型之间有任何区别,只要你有一个文档类型即可。但是文档类型将更改哪些属性和元素是有效的以及在哪个上下文中是有效的。使用
Choosing a Doctype
text/html
In a nutshell: Here are simple guidelines for choosing a doctype for a
new text/html document:
Standards mode, cutting edge validation
<!DOCTYPE html>
This is the right thing to do unless you have a specific reason to avoid it. With this doctype, you can validate new features such as
<video>
, <canvas>
and ARIA. Please be sure to test your page in the
latest versions of the top browsers. Standards mode, legacy validation
target
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
This doctype also triggers the standards mode, but lets you stick to legacy validation in case you want to avoid new features or more
precise validation of old features. You’d like to use the Standards
mode, but you use sliced images in table layouts and don’t want to fix
them
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
This gives you the Almost Standards mode. Please note that your layouts based on sliced images in tables are likely to break if you
later move to HTML5 (and, hence, the full Standards mode). You
willfully want the Quirks mode
No doctype.
Please don’t do this. Willfully designing for the Quirks mode will come and haunt you, your coworkers or your successors in the
future—when no one even cares about Windows IE 6 anymore (already no
one cares about Netscape 4.x and IE 5). Designing for the Quirks mode
is a bad idea. Trust me.
If you still want to support Windows IE 6, it is better to apply specific hacks for it using conditional comments than to regress other
browsers into the Quirks mode.
I am not recommending any of the XHTML doctypes, because serving XHTML
as text/html is considered harmful. If you choose to use an XHTML
doctype anyway, please note that the XML declaration makes IE 6 (but
not IE 7!) trigger the Quirks mode.
<section>
/heading thing 可以被解释为使用了错误的HTML元素来进行文档类型定义。另一篇文章在spacer.gif
和“基于表格的布局”方面让我感到困惑,而且篇幅很长,所以我没有阅读它,但我明白这些都是边缘情况。不过,我并不确定,并且半期望因为发布这个问题而被踩。 - Wesley Murch