Skip to content

Adapt object-fit, object-position by matching source #62

Closed
@AndyOGo

Description

@AndyOGo

Hy there,

I would really need to be able to change the additional attributes applied to the <img> tag, in particular those are object-fit, object-position and class.

I need this especially for professional art direction and to compensate for focal points of different renditions.

Suppose the following markup:

<picture>
  <source
    srcset="foo-sm.jpg, foo-sm@2.jpg x2"
    media="(min-width: 200px)"
    object-position="top center"
  />
  <source
    srcset="foo-md.jpg, foo-md@2.jpg x2"
    media="(min-width: 600px)"
    class="medium-addition-for-a-class"
  />
  <source
    srcset="foo-lg.jpg, foo-lg@2.jpg x2"
    media="(min-width: 900px)"
  />
  <img
    src="foo.jpg"
    srcset="foo@2.jpg x2"
    class="picture__img"
    alt="Foo image"
    object-fit="cover"
    object-position="center"
  />
</picture>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions