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-28.9.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.8.1 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.8.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.7.1 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.6.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.5.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.4.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.3.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_tech_docs-3.1.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.2.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.1.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-28.0.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.20.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.19.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.18.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_tech_docs-3.0.1 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.17.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.16.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.15.0 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
govuk_publishing_components-27.14.2 node_modules/govuk-frontend/govuk/tools/_px-to-em.scss