W3C验证器错误

时间:2012-09-18 03:36:04

标签: asp.net html image xhtml w3c-validation

当我使用W3c验证器检查我的网站时,它会显示

“必需属性”alt“未指定”以及

“上面给出的属性是您使用过的元素所必需的,但是您已经省略了它。例如,在大多数HTML和XHTML文档类型中,”script“属性在”脚本“上是必需的元素和“img”元素需要“alt”属性。类型的典型值为type =“text / css”for和type =“text / javascript”for。“

我该如何解决这个问题?

截图:

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 个答案:

答案 0 :(得分:1)

alt属性添加到您的<img />代码。

相关问题