Autoscale element to fill a container.
npm install tux-autoscaleAutoscale element to fill a container.
HTML Markup:
``html`
The only requirement for styling is that the parent element has the class with-Autoscale or the following styles.
`css`
.with-Autoscale {
overflow: hidden;
position: relative;
}
| Name | Type | Default | Description |
| ------ | ------- | ----- | ------ |
| autoscale | string | cover | Two modes: cover and contain. This option can be past to the initializing data attribute: data-autoscale="contain"`. |
| ratio | number | undefined | Set a predefined ratio. |
| height | number | undefined | Set a fixed height. |
| width | number | undefined | Set a fixed width. |
You have to supply both width and height if you want to set an initial size. This makes images render in correct size while they are loading.