Skip to content

What css calculation functions are supported in the sizes attribute of the html img tag #37966

@ceddlyburge

Description

@ceddlyburge

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img

What specific section or headline is this issue about?

The sizes attribute

What information was incorrect, unhelpful, or incomplete?

Its not clear whether css calculation funtions (calc, clamp etc) are supported in the sizes attribute of the html img tag.

There are plenty of blog posts and stack overflow questions where they do this, so I assume that it is at least partially supported, but I can't find any documentation that specifies it.

It is also a bit unclear what css units can be used, and what they mean in this context (I think em and rem are the same in this context for example, but they wouldn't be in corresponding css)

What did you expect to see?

A statement specifying which css calculation functions are supported, if any.

A statement specifying which css size units are supported, and any caveats (such as em and other font related sizes)

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Content:HTMLHypertext Markup Language docsaccepting PRFeel free to open a PR to resolve this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions