HTML5 - CSS3

W3C Errors and Solutions

W3C is an important factor for search engines. If your site has too many W3C errors, fixing these errors is very important for SEO.

What is W3C?

The World Wide Web Consortium, or W3C, sets web standards that web designers and developers around the world should pay attention to on their sites. Acting in accordance with these standards is important for both proper coding and SEO.

W3C standards are an important factor for search engines such as Google, Bing and Yandex.

Some W3C errors and solutions encountered on many sites.

Attribute “<” is not serializable as XML 1.0.

Improper use:

<a href='https://oguzturk.net/'</a>Contents/a>

Solution:

In the link above, the a tag is closed twice and the < sign is forgotten. You can fix this problem by removing the incorrect a tag.

The “type” attribute for the “style”

Example Errors:

  • The “type” attribute for the “style” element is not needed and should be omitted.
  • Warning: The type attribute for the style element is not needed and should be omitted.
<style type='text/css'> .example{color:#ffffff}</style>

Solution:

The type=’text/css’ code is not required when using CSS for the line. You can remove this code and fix the problem by just using <style> .example {color:#ffffff}</style>.

<div class=”entry” id=”entry-thumb”>

Example Error:

The first occurrence of ID “entry-thumb” was here.

Improper use:

<div class="entry" id="entry-thumb">

Solution:

Here, id=”entry-thumb” code tells us that it can be used in many different places on the page. You should not use the same code more than once in the ID usages on your page. If you want to use the same code more than once, use the class class instead of id.

Mismatch between Public and System

Example Errors:

  • Mismatch between Public and System identifiers in the DOCTYPE declaration
  • This document uses an inconsistent DOCTYPE declaration. The System Identifier http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd declares the XHTML 1.0 Transitional document type, but the associated Public Identifier -//W3C//DTD XHTML 1.0 Transitional//tr-TR does not match this document type.
  • The recommended Public Identifier for http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd is -//W3C//DTD XHTML 1.0 Transitional//EN.
  • Warning Unable to Determine Parse Mode!
  • The validator can process documents either as XML (for document types such as XHTML, SVG, etc.) or SGML (for HTML 4.01 and prior versions). For this document, the information available was not sufficient to determine the parsing mode unambiguously, because:

Improper use:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//en-GB" "http://www.w3.org/en/xhtml1/DTD/xhtml1-transitional.dtd">

Solution:

The above usage of <!DOCTYPE html… is not actually a wrong usage. But when you use it this way, you need to comply with all w3c standards, instead you can declare that your site supports HTML5 by using only <!DOCTYPE html> and solve the problem.

Attribute charset not allowed

Example Error:

Error: Attribute charset not allowed on element meta at this point.

Improper use:

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

Solution:

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

The above usage is correct for HTML5 sites.

Stray end tag input.

<input id="btn1">Click</input>

Solution:

Closing codes like input, img, br and hr is wrong, you don’t need to close these codes. The error above tells us that closing it like </input> is wrong.

Correct usage for input code:

<input type="button" id="btn" value="Click"/>

Attribute model-width not allowed

Example Errors:

  • Error: Attribute model-width not allowed on element div at this point.
  • Attribute mid not allowed on element div at this point.

Improper use:

<div class="example" model-width="222" mid='value'>

Solution:

Using tags such as model-width or mid within the div tag is not allowed. You can fix the problem by removing these codes.

Attribute alt not allowed

Example Error:

Error: Attribute alt not allowed on element a at this point.

Improper use:

<a href="https://oguzturk.net" title="My Site" alt="My Site">

Solution:

The alt tag is not a valid value for links. Just use the title tag.

An img element must have an alt attribute

Example Error:

Error: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.

Solution:

You are getting this error because the images on your site do not have alt tags. You can fix the problem by adding alt tags to your images.

The form role is unnecessary for element form.

Example Error:

Warning: The form role is unnecessary for element form.

Improper use:

<form role="form">

Solution:

Using role=”form” for the form tag is incorrect. You can fix this problem by removing the role=”form” code.

Error: Bad value https://www.w3.org/1999/xhtml

Example Errors:

  • Error: Bad value https://www.w3.org/1999/xhtml for the attribute xmlns (only http://www.w3.org/1999/xhtml permitted here).
  • TYPE html>↩<html xmlns=”https://www.w3.org/1999/xhtml” lang=”en” xml:lang=”en”>↩<head
  • Warning: Attribute xmlns is not serializable as XML 1.0.
  • TYPE html>↩<html xmlns=”https://www.w3.org/1999/xhtml” lang=”en” xml:lang=”en”>↩<head

Improper use:

<html xmlns="https://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

Solution:

The usage of <html xmlns=”https://www.w3.org/1999/xhtml” lang=”en” xml:lang=”en”> is incorrect. You can fix the problem by typing http:// instead of https://.

Element div not allowed as child of element h4 in this context.

Example Error:

Error: Element div not allowed as child of element h4 in this context. (Suppressing further errors from this subtree.)

Improper use:

<h4><div class="example">content</div></h4>

Solution:

Using <div> inside h1, h2, h3, h4, h5 and h6 tags is incorrect. You can fix the problem by removing the <div> code inside any of these tags. The correct way is to use h tags after the <div> tag.

The type attribute is unnecessary for JavaScript resources.

Example Error:

Warning: The type attribute is unnecessary for JavaScript resources.

Improper use:

<script type="text/javascript">js codes</script>

Solution:

In JavaScript usage for the line, type=’text/javascript’ code is not required, you can remove this code and fix the problem by using only <script>js codes</script>.

You can use the link below to perform W3c validation on your site.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top