Sha256: cbf0aecd9c7127777d505755b6f2c10623efb33ca6738a6f3c00aa9b481f0263

Contents?: true

Size: 1.12 KB

Versions: 237

Compression:

Stored size: 1.12 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) {
  @media only screen and (-webkit-min-device-pixel-ratio: $ratio),
    only screen and (     min-device-pixel-ratio: $ratio),
    only screen and (             min-resolution: #{($ratio*96)}dpi),
    only screen and (             min-resolution: #{$ratio}dppx) {
      @content;
    }
}

Version data entries

237 entries across 237 versions & 3 rubygems

Version Path
dxw_govuk_frontend_rails-3.5.0 vendor/assets/stylesheets/helpers/_device-pixels.scss
govuk_publishing_components-21.57.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.57.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.56.2 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.56.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.56.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.55.4 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.55.3 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.55.2 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.55.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.55.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.54.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.53.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.52.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.52.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.51.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.50.1 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.50.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.49.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss
govuk_publishing_components-21.48.0 node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss