# @npm-polymer/iron-fit-behavior

> Fits an element inside another element

Latest version **2.0.0** (published 2017-06-03) · http://polymer.github.io/LICENSE.txt license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @npm-polymer/iron-fit-behavior
pnpm add @npm-polymer/iron-fit-behavior
yarn add @npm-polymer/iron-fit-behavior
bun add @npm-polymer/iron-fit-behavior
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-06-03 |
| First published | 2017-06-03 |
| Weekly downloads | 0 |
| License | http://polymer.github.io/LICENSE.txt |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Maintainers | npm-polymer |
| Keywords | web-components, polymer, behavior |

## Links

- npm: https://www.npmjs.com/package/@npm-polymer/iron-fit-behavior
- Repository: https://github.com/PolymerElements/iron-fit-behavior
- Homepage: https://github.com/PolymerElements/iron-fit-behavior#readme
- Issues: https://github.com/PolymerElements/iron-fit-behavior/issues
- npm.io page: https://npm.io/package/@npm-polymer/iron-fit-behavior

## Dependencies (1)

- [@npm-polymer/polymer](https://npm.io/package/@npm-polymer/polymer.md) 2.0.1

## Recent versions

- 2.0.0 (latest) — 2017-06-03

## README

[![Build status](https://travis-ci.org/PolymerElements/iron-fit-behavior.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-fit-behavior)

_[Demo and API docs](https://elements.polymer-project.org/elements/iron-fit-behavior)_


## Polymer.IronFitBehavior

`Polymer.IronFitBehavior` fits an element in another element using `max-height` and `max-width`, and
optionally centers it in the window or another element.

The element will only be sized and/or positioned if it has not already been sized and/or positioned
by CSS.

| CSS properties | Action |
| --- | --- |
| `position` set | Element is not centered horizontally or vertically |
| `top` or `bottom` set | Element is not vertically centered |
| `left` or `right` set | Element is not horizontally centered |
| `max-height` set | Element respects `max-height` |
| `max-width` set | Element respects `max-width` |

`Polymer.IronFitBehavior` can position an element into another element using
`verticalAlign` and `horizontalAlign`. This will override the element's css position.

```html
  <div class="container">
    <iron-fit-impl vertical-align="top" horizontal-align="auto">
      Positioned into the container
    </iron-fit-impl>
  </div>
```

Use `noOverlap` to position the element around another element without overlapping it.

```html
  <div class="container">
    <iron-fit-impl no-overlap vertical-align="auto" horizontal-align="auto">
      Positioned around the container
    </iron-fit-impl>
  </div>
```

---
_Source: https://npm.io/package/@npm-polymer/iron-fit-behavior · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
