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-9.0.1 app/assets/docs/functions.md
govuk_frontend_toolkit-9.0.0 app/assets/docs/functions.md
govuk_frontend_toolkit-8.2.0 app/assets/docs/functions.md
govuk_frontend_toolkit-8.1.0 app/assets/docs/functions.md
govuk_frontend_toolkit-8.0.0 app/assets/docs/functions.md
govuk_frontend_toolkit-7.6.0 app/assets/docs/functions.md
govuk_frontend_toolkit-7.5.0 app/assets/docs/functions.md
idsk_frontend_toolkit-7.4.2 app/assets/docs/functions.md
govuk_frontend_toolkit-7.4.2 app/assets/docs/functions.md
govuk_frontend_toolkit-7.4.1 app/assets/docs/functions.md
govuk_frontend_toolkit-7.4.0 app/assets/docs/functions.md
govuk_frontend_toolkit-7.3.0 app/assets/docs/functions.md
govuk_frontend_toolkit-7.2.0 app/assets/docs/functions.md
govuk_frontend_toolkit-7.1.0 app/assets/docs/functions.md
govuk_frontend_toolkit-7.0.1 app/assets/docs/functions.md
govuk_frontend_toolkit-7.0.0 app/assets/docs/functions.md
govuk_frontend_toolkit-6.0.4 app/assets/docs/functions.md
govuk_frontend_toolkit-6.0.3 app/assets/docs/functions.md
govuk_frontend_toolkit-6.0.2 app/assets/docs/functions.md
govuk_frontend_toolkit-6.0.1 app/assets/docs/functions.md