简体   繁体   English

我在w3学校验证员身上得到了这个错误

[英]I got this error on w3 schools validator

Is anyone familiar with the following W3 School Validation error? 是否有人熟悉以下W3 School Validation错误? It is a simple IMG element and it is giving a very funny error on line 43. Column 112. I am stumped. 这是一个简单的IMG元素,它在第43行给出了一个非常有趣的错误。第112列。我很难过。


Error Line 43, Column 112: Attribute target not allowed on element img at this point. 错误行43,列112:此时元素img上不允许属性目标。

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

Attributes for element img: 元素img的属性:

Global attributes 全局属性

alt ALT

src SRC

crossorigin crossorigin

usemap USEMAP

ismap ISMAP

width 宽度

height 高度


A Quick Note: "Column 112" is the closing bracket of the <img/> syntax. 快速注释:“列112”是<img/>语法的结束括号。

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. 我不能为我的生活弄清楚这一点,这是阻止我的HTML5代码验证的唯一因素。 Just one little error according to W3 and I cannot understand this and any help would be greatly appreciated. 根据W3只有一个小错误,我无法理解这一点,任何帮助将不胜感激。

You have a target attribute on an img element. 你有一个img元素的target属性。 That isn't allowed and doesn't make sense. 这是不允许的,没有意义。

Delete target="_blank" 删除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 . 当你在它的时候,你应该摆脱title属性(因为它没有传达任何有用的信息)并写出更好的替代文字

Delete you target="_blank" from you img tag, because, it should be added on your a tag. 从你的img标签中删除你的target="_blank" ,因为它应该添加到你a标签上。 eg: 例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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