开发者

Need some clarification on HTML DOCTYPEs

开发者 https://www.devze.com 2023-02-12 00:31 出处:网络
I used PSPad for my WordPress template and just now realized the DOCTYPE was defaulted to: <!DOCTYPE HTML PUBLIC \"-//W3C//D开发者_JS百科TD HTML 4.01 Transitional//EN\">

I used PSPad for my WordPress template and just now realized the DOCTYPE was defaulted to:

<!DOCTYPE HTML PUBLIC "-//W3C//D开发者_JS百科TD HTML 4.01 Transitional//EN">

As FancyBox suggests a proper DOCTYPE, I tried a few of the following as listed here:

http://www.alistapart.com/articles/doctype/

My dilemma is that if I change the DOCTYPE now, my website looks worse (things off-center being most common). I'd appreciate hearing suggestions on how best to proceed. Is the default PSPad DOCTYPE incorrect and should I have started with one of the "official" ones instead? Am I better off spending a few days redesigning to match an "official" DOCTYPE? If I were to use the website in a career portfolio, would I need to be concerned if I leave the DOCTYPE as is?

Just not sure how to proceed from here. Thanks.

EDIT: Ironically, what took the most time to begin with is in attempting to ensure my website looked the same in both Firefox and Internet Explorer.


Best way to proceed is to switch to a proper, valid doctype. Spend the time to fix the issues that come up, and you'll be setting yourself up for much easier maintenance in the future.

Yes, the default PSPad doctype is incorrect. It is not a valid doctype and is putting the browser into quirks mode.

And yes, if you use it in a portfolio, anyone who knows code would likely dismiss it using the doctype you are currently using.

BTW, going forward I'd use the new HTML5 doctype, it's much simpler...

<!DOCTYPE html>


You should always use a Doctype (the article you mentioned is a bit outdated, I recommend Wikipedia instead).

The HTML5 doctype is the easiest: <!DOCTYPE html>

Your page renders differently with a Doctype because the browser changes into standards mode when it sees a Doctype, as opposed to quirks mode. Standards mode is the correct way the webpage should be rendered, and is more likely to be consistent across different browsers.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号