0
votes

Is anyone familiar with the following W3 School Validation error? It is a simple IMG element and it is giving a very funny error on line 43. Column 112. I am stumped.


Error Line 43, Column 112: Attribute target not allowed on element img at this point.

…/images/logo.png" target="_blank" alt="AltText" title="SomeTitle" />

Attributes for element img:

Global attributes

alt

src

crossorigin

usemap

ismap

width

height


A Quick Note: "Column 112" is the closing bracket of the <img/> syntax.

Does anyone know what on earth this means? I cannot for the life of me figure this out and it is the only thing stopping my HTML5 code from validating. Just one little error according to W3 and I cannot understand this and any help would be greatly appreciated.

2
What is a target attribute to do in an <img> tag? If you want to have a link, then use <a>. - Sirko
There's no such thing as "w3 schools validator". The W3C provide a validation service. W3Schools (who run a crappy tutorial site that is not affiliated with the W3C at all) link to it. - Quentin
The error message “Attribute target not allowed on element img” is rather self-explanatory. The continuation “at this point” might be misleading (it has a somewhat complicated explanation). - Jukka K. Korpela

2 Answers

2
votes

You have a target attribute on an img element. That isn't allowed and doesn't make sense.

Delete target="_blank"


While you are at it, you should get rid of the title attribute (as it doesn't convey any useful information) and write better alt text.

0
votes

Delete you target="_blank" from you img tag, because, it should be added on your a tag. eg:

<a href="#" target"_blank"><img src="#" /></a>