Basic Questions about Doc Type and HTML Version

HI there,

It’s been a while since I have been in the business of coding. I would like to know if this doc type and head I am using is sufficient for basic coding


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> </title>
<meta name="keywords" content=" " />
<meta name="description" content=" " />
<meta name="title" content="" />
<meta name="robots" content="index, follow" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="assets/styleSheet.css" media="screen,projection" />

That really sums it up.

Thanks for your help!

Yes, that’s fine. I don’t use all those metas, but it’s up to you. Keywords are generally ignored now, as far as I know. I gather it’s best to have the content-type straight after the <head> tag, lke so:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

The two other ‘up to date’ doctypes in use today are:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

and


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">

The first of these is the HTML 4.01 doctype, and the last one has come along mainly for use with HTML5, which is still in development, but the doctype itself is fine to use on any site. I tend to use the last one now, as it’s simpler.

Thanks for the response.

Is the last doc type, supported over all devices and much of the newest supporting browsers?

Something else I am thinking about… I am aware that Frames are antiquated; but what I like about them is the ease to manufacture a quick navigation between images and menus within a page with out loading a new page as well as getting caught up in all the extra hassles of Ajax. Do you see Frames remaining as useful elements using a transitional doc type? Does the last doc type you mention support frames?

I appreciate your helpfulness.

I’ve not found any devices or browsers that don’t cope with <!DOCTYPE html>, including older ones. What you will find is that some features of HTML5 are not supported in older browsers, but as long as you stick to code that is part of HTML4 you’ll be fine.

No, frames are not allowed in HTML5 – iframes are, but not frames.

If you want to swap images without loading a new page, you can do that with very simple Javascript, there’s no need to go for full-on AJAX. You might find that iframes give you the scope to do this without any form of scripting, although they do introduce their own problems. I can see why you might want to load images without loading a whole new page – but I’m not sure whether it’s worthwhile. If you’ve written your page well, the size of the actual HTML will be so much smaller than the image that it will seem to load more-or-less instantaneously. The total size of the HTML will probably be less than the size of the AJAX needed to accomplish an image swap as well!

I don’t generally recommend iframes as a solution – occasionally they are right, but more often they are wrong – without seeing your site in context, it’s difficult to be able to give you a more definite answer.

I’m not sure what you are describing there, but as Stevie says, you could probably use simple JavaScript, if not just CSS.

Thanks for the simple answers. : )

IE9 doesn’t allow frames neither…

I suppose, even if you use a doctype for html 4 or xhtml, it would’t work. (have to test it)

At work, we have an intraweb, with frames … :s
I guess we’ll have to change the whole thing now the company decided to work with Windows 7 where IE9 is the standard new browser. :aah: