Sha256: 7b7c4ce5059e13089dea1af041df9a43e3546df3492d259cde719401861cca87

Contents?: true

Size: 482 Bytes

Versions: 216

Compression:

Stored size: 482 Bytes

Contents

////
/// @group tools/unit-conversion
////

/// Convert pixels to em
///
/// @param {Number} $value - Length in pixels
/// @param {Number} $context-font-size - Font size of element
/// @return {Number} Length in ems
/// @access public

@function govuk-em($value, $context-font-size) {
  @if (unitless($value)) {
    $value: $value * 1px;
  }
  @if (unitless($context-font-size)) {
    $context-font-size: $context-font-size * 1px;
  }
  @return $value / $context-font-size * 1em;
}

Version data entries

216 entries across 213 versions & 4 rubygems

Version Path
govuk_publishing_components-27.7.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.6.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.5.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_tech_docs-3.0.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.4.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.3.1 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.3.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.2.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.1.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_tech_docs-2.4.3 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.0.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-26.0.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-25.7.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-25.6.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-25.5.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-25.4.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-25.3.1 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-25.3.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-25.2.3 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-25.2.2 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss