2012-09-18 97 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