Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-1099

Image tags should have "width" and "height" attributes

    XMLWordPrintable

    Details

    • Type: Bug Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Add both a 'width' and a 'height' attribute to this image.
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Legacy Key:
      ImgWithoutWidthOrHeightCheck
    • Covered Languages:
      HTML
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      10min

      Description

      If the width and height attributes are set, the space required for the image is reserved immediately by the browser, even before it actually starts to load the image.
      Without those attributes, the page layout constantly changes as images are loaded until they are all loaded, which can disorient users.

      Noncompliant Code Example

      <img src="logo.png" alt="My Company" />                           <!-- Non-Compliant -->
      

      Compliant Solution

      <img src="logo.png" alt="My Company" width="100" height="50" />   <!-- Compliant -->
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            freddy.mallet Freddy Mallet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: