H
Hostile17
Consider the following HTML.
----------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>Untitled</title>
<link rel="Stylesheet" href="mystylesheet.css" />
</head><body>
<img src="myimage.gif" alt="my image" width="100" height="100" />
</body>
</html>
----------
There's a guy a work who insists on coding like this. Or rather,
*some* of his images have a trailing slash, not others, and his link
tags, as above, have them, but not his meta-tags.
I don't know where he picked up the habit, but he says it's valid 4.01
Transitional, and it's also "best practice".
If it is, why aren't all his single tags like this, but let's move on.
In an attempt to get an official answer on this, I validate the above
at the W3C.
I get this result:
----------
Line 7, column 6: end tag for element "HEAD" which is not open
(explain...).
Line 8, column 5: document type does not allow element "BODY" here
(explain...).
----------
If I validate it with BBEdit's built-in Check Syntax, it give me this:
----------
File "xmlstyle.html"; Line 7: Document type doesn't permit empty XML
element; "<link/>".
File "xmlstyle.html"; Line 10: Document type doesn't permit empty XML
element; "<img/>".
----------
When I show these results to the coder, he says the W3C is complaining
about "HEAD and BODY tags on the same line" which is laughable, but
he's got a point when he says "BBEdit says the tags are empty. They're
not empty."
I could go on trying other validators, but I'm not happy with the
results of these.
Validated as 4.01 Strict, by the way, these tags are definitely
errors. "Character Data Is Not Allowed Here" with an arrow pointing to
the end of the tag.
What I want is someone to give me a definitive response, backed up by
a link to a reputable website, where it gives an answer either way. I
think I'm right but I can't cite anything.
To me coding this way is something like the HTML equivalent of wearing
a baseball cap backwards...
----------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>Untitled</title>
<link rel="Stylesheet" href="mystylesheet.css" />
</head><body>
<img src="myimage.gif" alt="my image" width="100" height="100" />
</body>
</html>
----------
There's a guy a work who insists on coding like this. Or rather,
*some* of his images have a trailing slash, not others, and his link
tags, as above, have them, but not his meta-tags.
I don't know where he picked up the habit, but he says it's valid 4.01
Transitional, and it's also "best practice".
If it is, why aren't all his single tags like this, but let's move on.
In an attempt to get an official answer on this, I validate the above
at the W3C.
I get this result:
----------
Line 7, column 6: end tag for element "HEAD" which is not open
(explain...).
Line 8, column 5: document type does not allow element "BODY" here
(explain...).
----------
If I validate it with BBEdit's built-in Check Syntax, it give me this:
----------
File "xmlstyle.html"; Line 7: Document type doesn't permit empty XML
element; "<link/>".
File "xmlstyle.html"; Line 10: Document type doesn't permit empty XML
element; "<img/>".
----------
When I show these results to the coder, he says the W3C is complaining
about "HEAD and BODY tags on the same line" which is laughable, but
he's got a point when he says "BBEdit says the tags are empty. They're
not empty."
I could go on trying other validators, but I'm not happy with the
results of these.
Validated as 4.01 Strict, by the way, these tags are definitely
errors. "Character Data Is Not Allowed Here" with an arrow pointing to
the end of the tag.
What I want is someone to give me a definitive response, backed up by
a link to a reputable website, where it gives an answer either way. I
think I'm right but I can't cite anything.
To me coding this way is something like the HTML equivalent of wearing
a baseball cap backwards...