Useful Broken Images: CSS Tutorial (Day 5 of CSS3 in 30 Days)

Whether it’s a typo in the img tag source, or the image itself was misplaced or removed on the server – images break all the time on the web. The problem is, the browsers default way to display a broken image is really ugly. You can fix that and actually use it as an opportunity to enhance the user’s experience on your web pages with CSS! That’s what you will learn about in this lesson.

⭐️Files you need ⭐️
💻Useful Broken Images Code:
💻All tutorials in this series need this “_theme-styles” directory (only download once):

This video works as a stand-alone tutorial but is also day 5 of CSS3 in 30 Days. For the rest of the series, check out this playlist:

CSS3 in 30 Days is developed by Brad Hussey. Check out his website for more great tutorials:

Learn to code for free and get a developer job:

Read hundreds of articles on programming:

And subscribe for new videos on technology every day:


This Post Has 18 Comments

  1. I love this series, really what i need. Takes the CSS to the next level 😀 Thank you so much man! <3

  2. BenRangel

    In my opinion, it can be dangerous to over-style your broken image placeholders. It's so unusual. Users are so accustomed to having the default broken images, that they might not even understand custom ones. They might think that a custom placeholder is the actual image, and that it's a fake image / joke image, rather than a broken link.

    You might actually miss out on some bug reports too, since people might not think of these images as "broken" any more.

  3. Alex Chi

    what if the noimage.png failed to download too?

  4. This only works in several optimal cases, like a particular image that you know you styled in a certain way. Adding an image width or height breaks the design and you can never be quite certain the 'not found part' will not overlap some element of the page. It's too bad there is no CSS general support for styling the not found image, I would have thought at least a CSS selector for ::notfound or ::loaderror would have been obvious for such a common scenario. (something like this: )

    Also, I though you should explain why this doesn't break images that load correctly, as many others notices.

    Thanks for the series, it's nice.

  5. Holy Sign

    When did brad define . image class in the html markup?

  6. it doesn't work in safari… the display of the broken image is different

  7. Cindy Mora

    Awesome tip for future projects! Loving this series!

  8. I am following your series and I must say its helping me a lot in learning.
    Thanks Brad.

  9. Mukesh Kumar

    I tried multiple times, but these styles are not working. 😔

  10. Business Opportunity in Ruvol

    I have invented a Board Game [still unpublished and not yet out in the market] that I believe is guaranteed to be as challenging and exciting as CHESS. I called it “RUVOL.”

    It is my hope that one day Ruvol may surpass chess as the “Number One Board Game in the World.”

    The weakness of chess is it always starts in fixed positions that the opening moves become “memorizable.” In fact, not a few have so mastered the moves that they can play against their opponents “blindfolded.” It is for this very reason that the great Bobby Fischer introduced his so-called “Fischer Random Chess,” where the starting position of the pieces is “randomized” to make the memorization of openings impracticable. Fortunately, it is also for this reason that I invented Ruvol where “every game” has been calculated to be a challenging one to play.


    I detailed everything in my YouTube video. Here is the link:


    It is worthwhile to note that the people who play chess will be the same people who will play Ruvol. In my Google search, I learned there are around 800 million chess players in the world. Even just a small percentage of these 800 million is good enough to earn big money from Ruvol either as an ONLINE GAME BUSINESS or as a PHYSICAL PRODUCT DISTRIBUTOR.

    You may contact me at:

    Thanks and God bless!


    The Ruvol Inventor

Leave a Reply