Welcome to WebmasterWorld Guest from 34.204.189.171

Forum Moderators: open

Some html validators are flagging these html tags as error.

     
2:05 am on Aug 17, 2019 (gmt 0)

Senior Member

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

joined:Dec 19, 2004
posts:993
votes: 14


Hi so I have the following html / metatags in my html file:

====
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5BBAD5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
====

Are these code valid? Please advise. Thanks!
7:44 am on Aug 17, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1194
votes: 285


Some html validators

Stick with the W3C Validator : [validator.w3.org...]

flagging these html tags as error.

Which kind of error? It looks good to me, (you don't need the " /> " on the first line) . However, it might depend of your DOCTYPE , but the above seems okay to me if , this is HTML 5.
1:13 pm on Aug 17, 2019 (gmt 0)

Senior Member

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

joined:Dec 19, 2004
posts:993
votes: 14


Ok thanks, the w3c validtor oks it. Additionally I have a script like this in the page:

<script type="text/javascript" charset="utf-8" src="https://www.abc.com/p/xyz.js"></script>

W3c validator is warning over the type & charset code (unneeded). Would keeping them as it is OK?
1:32 pm on Aug 17, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1194
votes: 285


W3c validator is warning over the type & charset code (unneeded). Would keeping them as it is OK?

Yes, you can keep the "type" and "charset", but as mentioned they are no longer needed in HTML5, however keeping them is okay.

edit: Indirectly related: stay consistent with your charset, don't start mixing different charset, this is going to be mess and hard to maintain. Stick with UTF8 for everything, including your database.
4:56 pm on Aug 17, 2019 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15874
votes: 872


In general, keeping something that w3c says isn't needed will not do any harm--but, like they say, it isn't needed. Sometimes you just have to use your judgement. Take the case of
style type = "text/css"
At one point the html validator and css validator weren't talking to each other, leading to (this is my actual email, sent in December 2017):
The HTML validator says:
Warning: The type attribute for the style element is not needed and should be omitted.

The CSS validator says:
Warning: You should add a 'type' attribute with a value of 'text/css' to the 'style’ element

Could the two of them at least try to get their stories straight?
Others besides me must have grumbled about the same thing, because it has since been fixed.
12:35 pm on Aug 20, 2019 (gmt 0)

Senior Member

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

joined:Dec 19, 2004
posts:993
votes: 14


Ok thanks guys. I'll leave the code as is.