Skip to content Skip to sidebar Skip to footer

Is Value For Alt Atrribute Not Required In Html5 To Pass Validation?

I was looking at this Slideshow http://www.slideshare.net/CharJTF/structures-semantics-controls-and-more-html-5-is-here-3523971 and on slide #14 there are 3 examples of img tag thi

Solution 1:

The parsing rules for attributes start here. Note that the default action on encountering the first character of an attribute is this:

Start a new attribute in the current tag token. Set that attribute's name to the current input character, and its value to the empty string. Switch to the attribute name state.

So in HTML5, alt and alt="" are equivalent.

It is acceptable to have an empty string value for an alt attribute when the image is entirely presentational (though really in that case, that image should be included with CSS rather than in the content), or when it would repeat information already available to the detriment of screen reader users. The point of putting an empty string there instead of leaving off altogether is that many screenreaders, if there isn't an alt attribute, will read out the full path in the src attribute instead.

Solution 2:

HTML 5 now definesfoo as being the same as foo=''

Post a Comment for "Is Value For Alt Atrribute Not Required In Html5 To Pass Validation?"