Skip to content

[selectors-4] additional resource state pseudo-classes for img / picture elements #7467

Open
@voxpelli

Description

@voxpelli

The Resource State Pseudo-classes section mentions (emphasis mine):

The pseudo-classes in this section apply to elements that represent loaded resources, particularly images/videos

Yet none of the currently defined pseudo classes seems to actually apply to any images.

Following up on a recent popular tweet that used onerror on img-tags to style failed images, I would like to mimic #3821 and resurrect a few of the pseudo-classes suggested in #3134

Primarily I would like to see:

  • :failed – a replacement for the use of onerror to style images that fail to load
  • :loading – a way to style images that are in the process of loading (would include both downloading and decoding I think)

Could also be useful to support the existing:

  • :stalled– as images on bad internet connections can very much stall to load as well, especially a progressive JPEG which could me stuck in a low quality state.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions