In ASP.Net is there a way to get the alt
attribute of server-side image tags to render with an empty value? Preferably without creating a new derived class?
In order to pass accessibility tests, I need to add alt=""
to images where they are purely decorative and there is no purpose for text to be read-out by screen readers.
But both of the following result in the alt
tag being ommitted, making the image fail the accessibility checks…
<img runat="server" src="~/myimage.jpg" alt="" />
<asp:Image runat="server" ImageUrl="~/myimage.jpg" AlternateText="" />
This is the rendered HTML…
<img src="myimage.jpg" />
<img src="myimage.jpg" style="border-width:0px;" />