Skip to content

[Bug + fix] The aspect ratio declaration can trigger from YYYY-MM-DD date in image file name #125

Description

@kazerniel

I'm not sure why the aspect ratio rules trigger on scr too, and not just alt, but this causes it to trigger from dates in the file name, such as "2025-11-10".

The following snippet can be used to override this while retaining the ability to set the ratio with the alt tag (repeated the alt rules in case both scr and alt would apply to a file):

.internal-embed.image-embed[src*="1-1"] > img,
img[src*="1-1"],
.internal-embed.image-embed[src*="4-3"] > img,
img[src*="4-3"],
.internal-embed.image-embed[src*="16-9"] > img,
img[src*="16-9"]
{
	aspect-ratio: unset;
	object-fit: unset;
}

img[alt*="1-1"]
{
	aspect-ratio: 1/1;
	object-fit: cover;
}

img[alt*="4-3"]
{
	aspect-ratio: 4/3;
	object-fit: cover;
}

img[alt*="16-9"]
{
	aspect-ratio: 16/9;
	object-fit: cover;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions