Sha256: 64a335afc1171488ed4dc34f7f9a3eaa46abdcf8e70809209016048fd0a84133

Contents?: true

Size: 1.08 KB

Versions: 300

Compression:

Stored size: 1.08 KB

Contents

////
/// @group helpers
////

/// Media query for retina images (device-pixel-ratio)
///
/// @param {Number} $ratio [2] - Device pixel ratio
/// @content Passed content will be outputted within the media query
///
/// @example scss - Providing a @2x image for screens that support it
///   background-image: govuk-image-url("my-image.png");
///
///   @include govuk-device-pixel-ratio {
///     background-image: govuk-image-url("my-image-2x.png");
///   }
///
/// @example scss - Using a custom ratio
///   background-image: govuk-image-url("my-image.png");
///
///   @include govuk-device-pixel-ratio {
///     background-image: govuk-image-url("my-image-2x.png");
///   }
///
///   @include govuk-device-pixel-ratio(3) {
///     background-image: govuk-image-url("my-image-3x.png");
///   }
///
/// @access public

@mixin govuk-device-pixel-ratio($ratio: 2) {
  // stylelint-disable indentation
  @media only screen and (-webkit-min-device-pixel-ratio: $ratio),
    only screen and (min-resolution: #{($ratio * 96)}dpi),
    only screen and (min-resolution: #{$ratio}dppx) {
      @content;
    }
}

Version data entries

300 entries across 297 versions & 5 rubygems

Version Path
dxw_govuk_frontend_rails-3.9.1 vendor/assets/stylesheets/helpers/_device-pixels.scss
govuk_publishing_components-23.10.2 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.10.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.10.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.9.2 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.9.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.9.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.8.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.7.7 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.7.6 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.7.5 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.7.4 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.7.3 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.7.2 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.7.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.7.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.6.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.5.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.5.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-23.4.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss