Search code examples
htmlxhtmlmeta-tagsmeta

Meta tag 'there is no attribute "property" ' and other attribute error:


I tried to validate my site and i get this following error

there is no attribute "property"

 <meta property="og:title" content="Free Sms" />

there is no attribute "allowTransparency"

…w:hidden; width:450px; height:21px;" allowTransparency="true">Facebook</iframe>

there is no attribute "placeholder"

…"search" type="text" placeholder="SEARCH" value="" class="searchInp …

First my code has this and i get 13 errors.

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

Changing the code to this reduce my error. but I get the 3 errors.Why? Any guide how to fix this?

<!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"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="https://www.facebook.com/2008/fbml"
      xml:lang="en" lang="en"> 

Complete

<!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"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="https://www.facebook.com/2008/fbml"
      xml:lang="en" lang="en"> 
<head> 
    <title>Welcome to mysite</title>
                   <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
                   <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 
                   <meta name="keywords" content="Social, Programming" />
                   <meta name="description" content="Share Ideas and become the best" />
                   <meta http-equiv="Content-Language" content="en" />
                   <meta name="robots" content="*" />
                   <meta name="document-type" content="text" />
                   <meta name="googlebot" content="NOODP" />
                   <meta name="slurp" content="NOYDIR" />
                   <meta name="msnbot" content="NOODP" />
                   <meta name="Generator" content="snippet" />
                   <meta property="og:title" content="Welcome to mysite" />
                   <meta property="og:type" content="website" />
                   <meta property="og:url" content="" />
                   <meta property="og:description" content="Share Ideas and become the best" />
                   <meta property="fb:app_id" content="" />
                   <meta property="og:image" content="http://mysite.com/images/fbicon.png" />

Solution

  • The attributes you mention are simply not part of XHTML 1.0 Transitional, so a validator has to report them as errors. Just remember that the concept of error is relative here: it means that the document does not conform to the document type definition it purports to comply with (by referring to a document type definition by the doctype declaration).

    The property attribute is not part of HTML5 CR either, but validators like http://validator.nu use a “schema for HTML5 + SVG 1.1 + MathML 3.0 + RDFa Lite 1.1”, where the RDFa part allows property.

    If your markup is a mix of XHTML 1.0 Transitional and HTML5, for example, just relax. The mix works in browsers and other relevant software, except for validators, which need to be picky. Just use a doctype that best corresponds to the markup you have, and manually check the error messages. If you get just 3 error messages when using XHTML 1.0 Transitional, keep using it, until you get fewer errors when checking against HTML5.