Forum Moderators: open

Message Too Old, No Replies

/ vs. </meta>

W3C Error

         

pageoneresults

2:30 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Please, validate your XML document first!
Line 12
Column 3
The element type "meta" must be terminated by the matching end-tag "</meta>".

Can't say that I've seen that error before and I've validated a lot of sites. The above error happens when validating a CSS file on a page built in XHTML. I've been using that closing </meta> since I started with XHTML years ago. I don't see many others using it, how come?

[edited by: encyclo at 3:19 pm (utc) on May 15, 2006]
[edit reason] fix typo [/edit]

Fotiman

2:55 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think most people prefer the shorthand version:

<meta ... />

The XHTML spec recommends using the shorthand version [w3.org], as the alternative syntax "gives uncertain results in many existing user agents."

pageoneresults

2:59 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<meta /> is invalid...

Error Line 5 column 72: end tag for "meta" omitted, but OMITTAG NO was specified.
...ype" content="text/html; charset=iso-8859-1"><meta />
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Fotiman

3:00 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can you post more of the HTML?

Fotiman

3:03 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This, for example, IS valid:

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

Fotiman

3:06 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think I see your mistake:

..ype" content="text/html; charset=iso-8859-1"><meta />

Is that bold text part of a meta tag? I'm assuming so, in which case it should either look like this:

..ype" content="text/html; charset=iso-8859-1" />

or this:

..ype" content="text/html; charset=iso-8859-1"></meta>

You had the / in the wrong place in the closing tag.

pageoneresults

3:07 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<meta http-equiv="Content-Type" content="text/html; charset:utf-8" />

Yes, there are two methods of closing off metadata in XHTML with the above being one and </meta> being the other.

The reason I use </meta> is because years ago when I made the switch, I was using Brett's SIM Spider and it didn't see the metadata when closed off with />.

Also, the above error posted is being generated by the W3C validator and will only be seen when validating CSS in a referer type scenario. I was surprised to see them recommend the </meta> to close off the metadata.

Fotiman

3:10 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sounds like a validator bug, then, since it doesn't do that when just validating the code (pasting it into the textarea and validating it). You might let the validator list know about it so they can fix it.

pageoneresults

3:10 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<meta ... />

I misunderstood your reply. I thought you were suggesting to close off with <meta />, sorry about that.

So, we're back to the two valid methods of closing off metadata in an XHMTL document environment.

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"></meta>

And...

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

Which takes me back to my original observation in that I've never seen the W3 return that particular error and then recommend a closing </meta> as opposed to <meta... />.

Fotiman

3:22 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think it's because the CSS Validator is not as "smart" as the HTML Validator, with regards to HTML validity. In other words, the CSS validator just knows that it can't parse the HTML because an element it not closed. This is not the CSS Validators area of expertise, so it just takes an educated guess. It would be nice if the HTML validator was integrated with the CSS validator here, but the fact is that they are 2 different validators for 2 different jobs. The HTML validator will offer better suggestions with regards to correcting the invalid HTML.

pageoneresults

3:29 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The HTML validator will offer better suggestions with regards to correcting the invalid HTML.

Actually, I think the CSS validator, when using the referer method will catch some things that the HTML validator will not. I'm trying to remember a specific error encountered when validating a CSS file. It was an i/o error and the HTML validator was not seeing it.

Error Line 5 column 72: end tag for "meta" omitted, but OMITTAG NO was specified.
...ype" content="text/html; charset=iso-8859-1">
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Yup, the HTML validator offers the one method of closing off meta.

Keep in mind that </meta> is valid.