<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

and

<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />

I know these are used more often then others but how do I know which ones best suit my site?

Possible List of others?

Possible better ones to suit my site?

Thanks, Regards X

Recommended Answers

All 6 Replies

Ya I have read there are different declerations for HTML and XHTML.

But I only have HTML and on another site PHP are there any recommened ones or is it just straight forward using loose, strict, etc.

It's down to how hte Browsers tend to repond - DocTypes tend to act as "how to read this" instructions to the Browser.
You'll find things like Quirks mode and the Box model in IE are different than Strict mode and the Box Model (look it up).


There is also "personal preference" too... I know some folks that refuse to move from html 4.01... saying it does everything it needs to, and XHTML is simply a pointless extra step.

While I know it's not proper form, you can skip using DOCTYPE and META TAGS. META TAGS no longer help with SEO, at least with Google, as they have stopped allowing people from doing this because they would put in a whole bunch of unrelated keywords to get traffic. I would recommend putting the crucial information in your title, and a description at the top of the page.

As for DOCTYPE, you can continue to use it, and it's not harmful. It only can behoove you, not disadvantage you.

Both are required to make the page validate with the W3C. Validation is a very good way to troubleshoot a malfunctioning page. It also makes the employers happy if you can make valid pages.

That meta tag is not used to guide search engines, but to tell the browser what character set to use. It is required for validation.

Midimagic just summed up what I was going to say.

I never liked using doctypes or meta tags (the extra code) but I realized over the last week its a curcial point that you need them if you have any commerical websites as it would have to be viewable on any browser.

So I am just using strict doctype at the moment and seems to work good with both browsers at the moment.

Also allowed my CSS code to be optimized, which was my intial intent on using doctypes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.