Wendy
Wendy

Reputation: 1

HTML Validation

My website is almost ready but I notice that my website shows in Firefox and IE look different and in chrome is fine. I have used HTML Validation to check and have 2 errors and 2 warnings. This is the details :

 Line 2, Column 13: there is no attribute "XMLNS"
 <html xmlns="http://www.w3.org/1999/xhtml">

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the element to incorporate flash media in a Web page, see the FAQ item on valid flash.

 Line 4, Column 76: NET-enabling start-tag requires SHORTTAG YES
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

For the current document, the validator interprets strings like according to legacy rules that break the expectations of most authors and thus cause confusing warnings and error messages from the validator. This interpretation is triggered by HTML 4 documents or other SGML-based HTML documents. To avoid the messages, simply remove the "/" character in such contexts. NB: If you expect to be interpreted as an XML-compatible "self-closing" tag, then you need to use XHTML or HTML5.

This warning and related errors may also be caused by an unquoted attribute value containing one or more "/". Example: http://w3c.org>W3C. In such cases, the solution is to put quotation marks around the value.

 Line 4, Column 77: character data is not allowed here
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include:

putting text directly in the body of the document without wrapping it in a container element (such as a

aragraph

), or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes), or using XHTML-style self-closing tags (such as ) in HTML 4.01 or earlier. To fix, remove the extra slash ('/') character. For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML.

 Line 44, Column 12: NET-enabling start-tag requires SHORTTAG YES
 <br/>

For the current document, the validator interprets strings like according to legacy rules that break the expectations of most authors and thus cause confusing warnings and error messages from the validator. This interpretation is triggered by HTML 4 documents or other SGML-based HTML documents. To avoid the messages, simply remove the "/" character in such contexts. NB: If you expect to be interpreted as an XML-compatible "self-closing" tag, then you need to use XHTML or HTML5.

This warning and related errors may also be caused by an unquoted attribute value containing one or more "/". Example: http://w3c.org>W3C. In such cases, the solution is to put quotation marks around the value.

As for Line 2, Column 13, I have added in this under header.php:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">   

However, this error is still there and I really do not know how to tidy it. On top of that, I am not a programmer and very poor in HTML....

Thank you.

Upvotes: 0

Views: 241

Answers (1)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201818

You are trying to validate a document with some XHTML features as HTML 4. You are not showing the first line of the HTML document, and this would be all-important. In general, you should show a complete HTML document that reproduces the issue. But in this case, the apparent reason is wrong DOCTYPE. You should replace the existing HTML 4 DOCTYPE by one that declares some version of XHTML 1.0, if XHTML 1.0 is what you are trying to use.

Upvotes: 0

Related Questions