Sha256: 8d0d1eb7a569538141db5cf138105e23865e334debac74f8ef7303a62a86648a

Contents?: true

Size: 813 Bytes

Versions: 55

Compression:

Stored size: 813 Bytes

Contents

## Functions

* [`_helpers.scss`](#helpers)

### <a id="helpers"></a>Helpers

The pixel-to-em or `pem` function returns an em value.

It sets a Sass variable, $base-font-size, to 16.

A value in em is defined as em = target/context.

#### Usage:

Here the default context is 16 ($base-font-size),
so there is no need to use a second argument.

```

.govuk-title {
  margin-top: pem(30);
}

Compiled css:

.govuk-title {
  margin-top: 1.875em;
}

```

The first argument will also accept pixel units.

```
.govuk-title {
  margin-top: pem(19px);
}

Compiled css:

.govuk-title {
  margin-top: 1.1875em;
}

```

If the context changes, use the second argument.

```
.govuk-title {
  font-size: 48px;
}

.govuk-title-child {
  margin-top: pem(15, 48);
}

Compiled css:

.govuk-title-child {
  margin-top: 0.3125em;
}

Version data entries

55 entries across 55 versions & 2 rubygems

Version Path
govuk_frontend_toolkit-4.14.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.13.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.12.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.11.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.10.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.9.1 app/assets/docs/functions.md
govuk_frontend_toolkit-4.9.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.8.2 app/assets/docs/functions.md
govuk_frontend_toolkit-4.8.1 app/assets/docs/functions.md
govuk_frontend_toolkit-4.8.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.7.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.6.1 app/assets/docs/functions.md
govuk_frontend_toolkit-4.6.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.5.0 app/assets/docs/functions.md
govuk_frontend_toolkit-4.4.0 app/assets/docs/functions.md