javascript - Why does W3 validation require populated alt and src attribute for images? -


I am not using these properties as I dynamically add the source later. I do not need ALT either, I want my page to be valid. I can bypass this requirement by using a CSS background inside a div. Is this a legitimate approach?

Explanation:

  • I do not care about search engines.

  • My images are always loaded.

  • I have set up the SRC attribute using javascript.

  • Major modern browsers for

  • Accessibility is not necessary yet.

  • Doctype HTML5 - & lt ;! DOCTYPE html & gt; Post-text "itemprop =" text ">

    because it is valid for a specification

    HTML is a specific structure that is documented on the site. W3 validation assumes that the input specification matches, in this case the requirements match:

    src attribute should be present

    An IMG tag with any source has undone the behavior, for example, depending on the browser, instead of a valid image it can re-request the current page.

    The Alt attribute should be specified and its value should not be empty

    From the same reference, the need for Alt attribute The justification for:

    [alt attribute] should be the replacement text which can be used by users instead of the image

    the reason for invalid markup < / H2>

    By question:

    I do not use these properties because I later dynamically changed the source Sector I introduce. If you want to add swap to dynamically (which also indicates that this specific bit of JavaScript, without page, or at least this markup, is of no use). Anyone) - why not add the img tag dynamically.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -