2012-09-18 126 views
0

当我使用W3C validater检查我的网站,它显示W3C校验错误

“必需属性‘ALT’未指定”,也

“是必需的元素上面给出的属性,该属性例如,在大多数HTML和XHTML文档类型中,“script”元素需要“type”属性,“img”元素需要“alt”属性。 type的值为type =“text/css”,type =“text/javascript”为。“

我该如何解决这个问题?

截图:

enter image description here

这是我的编码:

protected string GetImageStyle(ImageStub image) 
    { 
     if (!image.ImageID.IsNull) 
     { 
      image = image.ScaleOptimalWidth(75, 75); 
      return String.Format("width:75px;height:75px;align='left';-moz-border-radius: 6px;-webkit-border-radius: 6px;border-radius: 6px; padding-left: 2px;alt='img';"); 
     } 

     return "width:75px;height:75px;align='left';alt='img'"; 
    } 
+1

给我们一个小提示,看看你的代码是什么。 –

回答

1

添加alt属性您<img />标签。

+1

有关更广泛的解释,请参见[WCAG 2:在img元素上使用alt属性](http://www.w3.org/TR/WCAG20-TECHS/H37) – steveax

+0

@Dima alt属性已经存在。 – Sujanth

+0

@Sujanth根据截图,你已经把ALT放在STYLES属性中,当它应该是一个单独的属性 – Dima