Will this DOCTYPE and meta data code be non-problematic for several years?

I want to put up hundreds of html pages and I don’t want to have to make changes to the xhtml for several years.
The pages I created using the code shown pass W3C. I have used the word “example” in places in the code
to keep out extraneous info (just for this post).

Is the code below adequate or in need of extra meta-data, other info, or changes?

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“content-type” content=“text/html; charset=UTF-8” />
<title>example</title>
<meta name=“keywords” content=“example” />
<meta name=“description” content=“example” />
<link rel=“stylesheet” type=“text/css” href=“example.css” />
</head>

Is there a particular reason you’re not going with a strict DOCTYPE?

The code is technically OK, but I’d put that into a PHP (or any other programming language) include so that you only ever need to edit a single file instead of a hundred or more, should the need arise.

Example (with your code):

header.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>example</title>
<meta name="keywords" content="example" /> 
<meta name="description" content="example" /> 
<link rel=

“stylesheet” type=“text/css” href=“example.css” />
</head>

And in your index.php (or any other language):


// Include header HTML document into index.php
<?php
include('header.html');
?>

The reason for not making the DOCTYPE strict is my concern that a strict doctype would not be “compatible” with older browsers.

Is this a possibility or reason for concern?

I will be learning PHP as well as Javascript in the next few months. For the time being I wanted to make some base pages to be found by search engines.

Using a strict DOCTYPE won’t cause any issues with older browsers, HTML4.01 strict won’t even cause problems with messy markup. If you code your HTML document properly, no hiccups can occur, so if that is accounted for then you’re absolutely safe using a strict DOCTYPE. It’s the way to go. I’d also recommend going with HTML 4.01 strict as that is the current standard (rather than using any flavors of XHTML).

Thanks, Kohoutek. I will use this:

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

Quick follow up, if I use the above post Strict code should I delete the extra code other than HTML in this line I originally had? –

<html xmlns="http://www.w3.org/1999/xhtml">

That attribute needs to go as you’re using HTML, so something like this:

<!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">
    <title>Add Ttitle</title>
    <meta name="description" content=""">
    <meta name="keywords" content="">
    <meta name="author" content="">
    <link rel="stylesheet" href="/css/main.css" media="screen">
    <link rel="stylesheet" href="/css/print.css" media="print">
    <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/favicon.ico">
  </head>



Thanks, Kohoutek. I will use that as a guideline.

The most up-to-date doctype—which will also serve you well into the future—is this:


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

That’s what I use now. It’s simpler, and all you need these days.

It’s not a huge issue what doctype you have, as long as you have one, but certainly go for strict if not the one above. Transitional is only for very old websites.

Thanks, Ralph. I studied most of css and html fairly thoroughly over the past few months but then realized I knew little about the stuff goes at the very top of an html page.

I use html5 doctype for all my sites now, is there a downside to doing so?

Just remember that html5 is still in draft mode. The current standard still is HTML 4.01 and the recommended version by the W3C.

Please note that I’m not in any way recommending against using html5. I use html5 occasionally, many use HTML4.01 with the new html doctype. I’m a bit old-school in that regard. If I use HTML 4.01, I’d like to reflect that in the DOCTYPE. It’s a matter of preference and you can’t go wrong with either.

More information:

HTML 4.01
HTML5

The doctype I included above is really a generic one that is fine for any flavor of HTML, so far as I know. From a browser’s point of view, there is either a doctype or there isn’t. If no dictype, it goes into quirks mode; if there is a doctype, it assumes it’s a modern site. that’s my understanding, anyhow.

Which doctype you use will matter to a validator, but that’s kind of irrelevant.

It isn’t valid for HTML 1 as HTML 1 doesn’t allow a doctype.

It is valid for any version of HTML from HTML 2 through HTML 4 which are SGML based specifications and where that doctype is the short version of the SGML identifier for the type of document that the standard is for.

It is also valid for HTML 5 which like HTML 1 isn’t SGML compatible and therefore doesn’t follow the document definition standards but which unlike HTML 1 through HTML 4 actually defines that as an HTML tag. So while the same doctype works for HTML 5 as for HTML 2 - one is SGML while the other is THLM.

Thanks for clarifying, Stephen.

I’m not losing any sleep over that one. :smiley:

one is SGML while the other is THLM.

Is that last one a typo or another darned initialism I’ve gotta learn?

Switching to Strict has caused a problem.

There were unwanted spaces below several images which I corrected by applying

display: block

.

However, some 728 x 90 java script ads that are enclosed in <div> still have the unwanted small space below them despite
applying

display: block;

or

vertical-align: bottom;

to the div.

These java script ads are reacting like images but not corrected by the same solution as images were.

Is there some code to put in the div containing the java script to get rid of the space below each ad?

A deliberate typo - since HTML 5 isn’t SGML it can’t be a markup language since SGML is the standard for defining markup languages. Therefore it must be something else - perhaps a Text HyperLanguage Markdown or something instead. Anyway HTML 5 is non-standard where HTML 2 through 4 all followed the standards. Obviously those involved in HTML 5 don’t care about standards.

Off Topic:

I had actually guessed he made that typo deliberately but didn’t want to let the cat out. The prior sentences gave a big hint. :wink:

Can you provide a link?

Victorinox, here is a link: http://www.nanoweather.com

It’s the small black space below each of the 3 horizontal rectangular ads.

I also had it below the images on the right and left sidebars but {display: block;} on the images fixed it.

Here is an enlarged screencap showing the gap or space I refered to: