Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 15, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 15, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 15, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 15, 2025

      Intel’s latest Arc graphics driver is ready for DOOM: The Dark Ages, launching for Premium Edition owners on PC today

      May 15, 2025

      NVIDIA’s drivers are causing big problems for DOOM: The Dark Ages, but some fixes are available

      May 15, 2025

      Capcom breaks all-time profit records with 10% income growth after Monster Hunter Wilds sold over 10 million copies in a month

      May 15, 2025

      Microsoft plans to lay off 3% of its workforce, reportedly targeting management cuts as it changes to fit a “dynamic marketplace”

      May 15, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      A cross-platform Markdown note-taking application

      May 15, 2025
      Recent

      A cross-platform Markdown note-taking application

      May 15, 2025

      AI Assistant Demo & Tips for Enterprise Projects

      May 15, 2025

      Celebrating Global Accessibility Awareness Day (GAAD)

      May 15, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Intel’s latest Arc graphics driver is ready for DOOM: The Dark Ages, launching for Premium Edition owners on PC today

      May 15, 2025
      Recent

      Intel’s latest Arc graphics driver is ready for DOOM: The Dark Ages, launching for Premium Edition owners on PC today

      May 15, 2025

      NVIDIA’s drivers are causing big problems for DOOM: The Dark Ages, but some fixes are available

      May 15, 2025

      Capcom breaks all-time profit records with 10% income growth after Monster Hunter Wilds sold over 10 million copies in a month

      May 15, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Alt Text: Not Always Needed

    Alt Text: Not Always Needed

    November 25, 2024

    Alt text is one of those things in my muscle memory that pops up anytime I’m working with an image element. The attribute almost writes itself.

    <img src="image.jpg" alt="">

    Or if you use Emmet, that’s autocompleted for you. Don’t forget the alt text! Use it even if there’s no need for it, as an empty string is simply skipped by screen readers. That’s called “nulling” the alternative text and many screen readers simply announce the image file name. Just be sure it’s truly an empty string because even a space gets picked up by some assistive tech, which causes a screen reader to completely skip the image:

    <!-- Not empty -->
    <img src="image.jpg" alt=" ">

    But wait… are there situations where an image doesn’t need alt text? I tend to agree with Eric that the vast majority of images are more than decorative and need to be described. Your images are probably not decorative and ought to be described with alt text.

    Probably is doing a lot of lifting there because not all images are equal when it comes to content and context. Emma Cionca and Tanner Kohler have a fresh study on those situations where you probably don’t need alt. It’s a well-written and researched piece and I’m rounding up some nuggets from it.

    What Users Need from Alt Text

    It’s the same as what anyone else would need from an image: an easy path to accomplish basic tasks. A product image is a good example of that. Providing a visual smooths the path to purchasing because it’s context about what the item looks like and what to expect when you get it. Not providing an image almost adds friction to the experience if you have to stop and ask customer support basic questions about the size and color of that shirt you want.

    So, yes. Describe that image in alt! But maybe “describe” isn’t the best wording because the article moves on to make the next point…

    Quit Describing What Images Look Like

    The article gets into a common trap that I’m all too guilty of, which is describing an image in a way that I find helpful. Or, as the article says, it’s a lot like I’m telling myself, “I’ll describe it in the alt text so screen-reader users can imagine what they aren’t seeing.”

    That’s the wrong way of going about it. Getting back to the example of a product image, the article outlines how a screen reader might approach it:

    For example, here’s how a screen-reader user might approach a product page:

    1. Jump between the page headers to get a sense of the page structure.
    2. Explore the details of a specific section with the heading label Product Description.
    3. Encounter an image and wonder “What information that I might have missed elsewhere does this image communicate about the product?”

    Interesting! Where I might encounter an image and evaluate it based on the text around it, a screen reader is already questioning what content has been missed around it. This passage is one I need to reflect on (emphasis mine):

    Most of the time, screen-reader users don’t wonder what images look like. Instead, they want to know their purpose. (Exceptions to this rule might include websites presenting images, such as artwork, purely for visual enjoyment, or users who could previously see and have lost their sight.)

    OK, so how in the heck do we know when an image needs describing? It feels so awkward making what’s ultimately a subjective decision. Even so, the article presents three questions to pose to ourselves to determine the best route.

    1. Is the image repetitive? Is the task-related information in the image also found elsewhere on the page?
    2. Is the image referential? Does the page copy directly reference the image?
    3. Is the image efficient? Could alt text help users more efficiently complete a task?

    This is the meat of the article, so I’m gonna break those out.

    Is the image repetitive?

    Repetitive in the sense that the content around it is already doing a bang-up job painting a picture. If the image is already aptly “described” by content, then perhaps it’s possible to get away with nulling the alt attribute.

    This is the figure the article uses to make the point (and, yes, I’m alt-ing it):

    Showing a caption describing an image located directly above it.

    The caption for this image describes exactly what the image communicates. Therefore, any alt text for the image will be redundant and a waste of time for screen-reader users. In this case, the actual alt text was the same as the caption. Coming across the same information twice in a row feels even more confusing and unnecessary.

    The happy path:

    <img src="image.jpg" alt="">

    But check this out this image about informal/semi-formal table setting showing how it is not described by the text around it (and, no, I’m not alt-ing it):

    If I was to describe this image, I might get carried away describing the diagram and all the points outlined in the legend. If I can read all of that, then a screen reader should, too, right? Not exactly. I really appreciate the slew of examples provided in the article. A sampling:

    1. Bread plate and butter knife, located in the top left corner. 
    2. Dessert fork, placed horizontally at the top center. 
    3. Dessert spoon, placed horizontally at the top center, below the dessert fork.

    That’s way less verbose than I would have gone. Talking about how long (or short) alt ought to be is another topic altogether.

    Is the image referential?

    The second image I dropped in that last section is a good example of a referential image because I directly referenced it in the content preceding it. I nulled the alt attribute because of that. But what I messed up is not making the image recognizable to screen readers. If the alt attribute is null, then the screen reader skips it. But the screen reader should still know it’s there even if it’s aptly described.

    The happy path:

    <img src="image.jpg" alt="">

    Remember that a screen reader may announce the image’s file name. So maybe use that as an opportunity to both call out the image and briefly describe it. Again, we want the screen reader to announce the image if we make mention of it in the content around it. Simply skipping it may cause more confusion than clarity.

    Is the image efficient?

    My mind always goes to performance when I see the word efficient pop up in reference to images. But in this context the article means whether or not the image can help visitors efficiently complete a task.

    If the image helps complete a task, say purchasing a product, then yes, the image needs alt text. But if the content surrounding it already does the job then we can leave it null (alt="") or skip it (alt=" ") if there’s no mention of it.

    Wrapping up

    I put a little demo together with some testing results from a few different screen readers to see how all of that shakes out.

    CodePen Embed Fallback

    Alt Text: Not Always Needed originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous Article10 Best 2024 Black Friday Deals for Designers and Agencies
    Next Article Breaking down CPU speed: How utilization impacts performance

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 16, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4743 – Code-projects Employee Record System SQL Injection Vulnerability

    May 16, 2025
    Leave A Reply Cancel Reply

    Hostinger

    Continue Reading

    How to choose the right image format

    Development

    Razer’s brand-new, redesigned Blade 16 gaming laptop may have finally achieved perfection

    News & Updates

    CISA Warns 2 SonicWall Vulnerabilities Under Active Exploitation

    Security

    MMITech Hosting

    Web Development

    Highlights

    Development

    Cephalo: A Series of Open-Source Multimodal Vision Large Language Models (V-LLMs) Specifically in the Context of Bio-Inspired Design

    June 23, 2024

    Materials science focuses on studying and developing materials with specific properties and applications. Researchers in…

    Hiring Kit: Compliance Analyst

    July 10, 2024

    CyberArk to Acquire Venafi for $1.54 Billion, Enhancing Machine Identity Security

    May 21, 2024

    Russian Host Proton66 Tied to SuperBlack and WeaXor Ransomware

    April 22, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.