简体   繁体   中英

I got this error on w3 schools validator

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.

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 .

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM