I have the following errors on my page, when validated with http://validator.w3.org/
there is no attribute "placeholder"
there is no attribute "autocomplete"
in details it says:
Line 59, Column 81: there is no attribute "placeholder"
…rd" type="text" style="width:500px;" placeholder=" What" autocomplete="off" />
✉
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.
the html tag is here: <input name="keyword" id="keyword" type="text" style="width:500px;" placeholder=" What" autocomplete="off" />
If you are using html5 then you should use normal doctype.
<!DOCTYPE HTML>
<html>
<head>
<TITLE>My first HTML document</TITLE>
</head>
<body>
<input name="keyword" id="keyword" type="text" style="width:500px;" placeholder=" What" autocomplete="off" />
</body>
</html>
if you are using html4 or anything else then you can use following one of this
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
For more info..
http://www.w3.org/TR/html-markup/syntax.html#normal-doctype
make sure your using the html5 doctype <!DOCTYPE html>
And that the validator is validating HTML5
Related
I'm new to XHTML and I keep getting this error and can't find the solution anywhere.
Here's the error:
error.png
Here's my code:
<!DOCTYPE html public "-//project//test.xhtml">
<html>
<head>
<title>Tools</title>
<link href="oof.css" rel="stylesheet"type="text/css">
</head>
<body>
<div class="page">
<!DOCTYPE html public "-//project//test.xhtml"> is not an XHTML Doctype.
The specific error you get is because an identifier has to be PUBLIC or SYSTEM and it is case sensitive.
The Doctype needs to reference the DTD you are validating against, not an XHTML document.
Most XHTML documents will use this Doctype:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
However, there is little point in using XHTML 1.0 in 2018. You would probably be better off using HTML 5 instead.
If you are using the XML serialisation of HTML 5, then you wouldn't use a Doctype at all.
Most people don't get any benefit from using XML though, and would be better off writing HTML instead. That uses the Doctype:
<!DOCTYPE html>
… and then only for historical reasons to trigger Standards mode in browsers.
You have a lot of errors in your syntax.
LINK tag is a self closing tag.
DOCTYPE html public "...." defines some info. Read about it here
Every opening tag has a closing tag
Here's what it should look like
<!DOCTYPE html public "-//project//test.xhtml">
<html>
<head>
<title>Tools</title>
<link href="oof.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page"></div>
</body>
</html>
I am trying to validate my code using w3c-validator
Encoding: utf-8
Doctype:XHTML 1.0 Frameset
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Openfire Archived IM content Search</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<p>
<!--The following javascript function re-directis the user to the same page-->
<script type="text/javascript">
function startover(){
window.location="http://localhost/openfireIMsearch/index.php"
}
</script>
<!--html form for start-over button. The javascript function startover() is called when the user clicks this button-->
<form method="get" action= "index.php" name = "re-login">
<input type = "button" value ="Start Over" onclick = "startover()" />
<input type = "hidden" name = "re-login-hidden" value ="re-login-on" />
</form>
</p>
</body>
</html>
I am getting the following error which I have no clue about:
Line 7, Column 6: document type does not allow element "body" here
✉ The element named above was found in a context where it is
not allowed. This could mean that you have incorrectly nested elements
-- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed). One
common cause for this error is the use of XHTML syntax in HTML
documents. Due to HTML's rules of implicitly closed elements, this
error can create cascading effects. For instance, using XHTML's
"self-closing" tags for "meta" and "link" in the "head" section of a
HTML document may cause the parser to infer the end of the "head"
section and the beginning of the "body" section (where "link" and
"meta" are not allowed; hence the reported error).
Error message seems to indicate that one reason could be my use of meta tag. But the doctype clearly indicates that the document is XHTML and not HTML. I am at loss here. Could anybody shed some light? Thanks!
Your doctype seems to be telling me that it is a frameset. This would make body tags illegal and you would instead expect to have a frameset instead. Its a while since I've done any frames though so I might be misremembering that.
And in case its not obvious the solution would be to find the correct doctype. Something like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
http://www.w3.org/QA/2002/04/valid-dtd-list.html seems to have a list to choose from (and is where I copied the above from).
i use the facebook and twitter plugins in my html 4.01 strict doctype,which give me the following error.
Error Line 166, Column 23: there is no attribute "HREF"
Line 166, Column 107: there is no attribute "SHOW_FACES"
please help me how i removed these validation error's from my html page.
i use the following doctype and code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
facebook code
<fb:like-box href="http://www.facebook.com/pages/mysite/45662125588" width="692" show_faces="true" stream="true" header="true"></fb:like-box>
please help me if you have any suggestion
Try this:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml"
xmlns:google="http://base.google.com/ns/1.0"
xmlns:twitter="http://api.twitter.com/">
Then if that doesn't work, change the DOC type to something like this
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
Currently, it seems that the only way for validator + facebook plugin to work is to use
HTML5 doctype
<!doctype html>
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Are self-closing tags valid in HTML5?
For example:
<div id="myDiv" />
Something would then be done to populate this div using Javascript.
Is this valid HTML?
No. HTML 4.x doesn't have any concept of self closing tags.
It is valid in XHTML.
Div's are not valid self closing tags. To have an empty div it would be better to do this:
<div id="myDiv"></div>
According to the XML declaration and the XHTML 1.0 and 1.1 document definitions, this is fine: the null-end tag (>) may be used when immediately following the null-end start tag closer (/), and your code is equivalent to <div id="myDiv"></div>.
It's a different matter entirely whether any particular consumer will be able to process this correctly.
The SGML declaration used by HTML 4.01 allows tag shortening, but it has a different syntax for the null-end tags; there you can write <div id="abc"/this is a non-empty div/. Again, mileage may vary as for browser support. (My money is on "none".)
Future versions of HTML (HTML5? if that name is still alive) are no longer implemented as SGML languages, and therefore they simply allow what they say they do, without recourse to a formal grammar.
I ran these two blocks of code through the W3C validator. Copy and paste the code into the input under the Validate by Direct Input tab to see the results for yourself.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>title</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" >
</head>
<body><div id="Mydiv" /></body>
</html>
The code block with Doctype of transitional HTML 4.01 failed the validation process.
<!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" lang="en">
<head>
<title>Test</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
</head>
<body><div id="Mydiv" /></body>
</html>
When I added the XHTML 1.0 transitional doctype, changed the meta tag to a self closing tag, and added in the html xmlns line, the validation passed.
So to answer the first half of your question, it is valid HTML under the XHTML 1.0 Transitional doctype. Whether or not you can use javascript to properly populate it, I am not sure.
Self Closing Tags in XHTML as implemented by browsers:
What are all the valid self-closing elements in XHTML (as implemented by the major browsers)?
Self Closing tags in html5:
Are (non-void) self-closing tags valid in HTML5?
No, it's valid XML (not HTML), and as far as I know, will only be accepted if the document is send with an application/xml mimetype.
However, it may work with XHTML, and the XHTML Doctype declaration.
I am using few facebook social plugins and I am using the meta header. When validating the page, the W3C validator is throwing the error -> "Error: there is no attribute "property".
I am using the XHTML Transitional doctype - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Pls Suggest if I have to change the doctype to something else.
Facebook's plugins use Open Graph, which is built on RDFa. It's RDFa that adds the property attribute to elements. Without this addition, plain HTML has no such attribute. (If you ask me, it's a strange design to add a new attribute without namespacing it, and to re-use half of a <meta> tag. But no-one did.)
To validate XHTML-with-RDFa, you'll need the DOCTYPE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
This means you will have to be writing valid XHTML 1.1. More
In order for a document to claim that it is a conforming HTML+RDFa document, it must provide the facilities described as mandatory in this section. The document conformance criteria are listed below, of which only a subset are mandatory:
All document conformance requirements stated as mandatory in the HTML5 specification must be met.
There should be a version attribute on the html element. The value of the version attribute should be HTML+RDFa 1.0 if the document is a non-XML mode document, or XHTML+RDFa 1.0 if the document is a XML mode document.
There may be a link element contained in the head element that contains profile for the the rel attribute and http://www.w3.org/1999/xhtml/vocab for the href attribute.
Example:
<html version="HTML+RDFa 1.1" lang="en">
<head>
<title>Example Document</title>
</head>
<body>
<p>Moved to example.org.</p>
</body>
</html>
As Open Graph suggests, if you're using HTML5, you're better off just using a prefix attribute like this:
<!doctype html>
<html prefix="og: http://ogp.me/ns#">
<head>
<title>HTML5 site</title>
<meta property="og:title" content="The Rock" />
</head>
<body>
</body>
</html>
You can leave the doctype as is and it will validate.
This approach has also been recommended by an Open Graph developer.