1.1.1 • Published 3 years ago

@verndale/object-fit v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@verndale/object-fit

npm version npm bundle size GitHub license npm

Pollyfill for object-fit and object-position.

Settings

AttributeSupported optionsDefault
data-object-fitcover | containcover
data-object-position top | center | bottom percentage | length (px, em, rem, etc) | left | center | right inheritcenter

Usage

Installing using npm

npm i @verndale/object-fit

And then simply import the pollyfill.

JS

import '@verndale/object-fit';

HTML

Set data-object-fit and data-object-position.

<img
  src="example.jpg"
  data-object-fit="cover"
  data-object-position="center"
/>

CSS

Customize your properties for browsers that do support these properties.

img {
  object-fit: cover;
  object-positon: center;
}

Demo

You can see the demo here: https://833jx.csb.app/

1.1.1

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago