UNPKG

nav-frontend-core

Version:

Variabler og andre felleselementer for NAV-frontend.

109 lines (92 loc) 2.42 kB
/* ------------- CLEARFIX ------------- */ // Clearfix // // For modern browsers // 1. The space content is one way to avoid an Opera bug when the // contenteditable attribute is included anywhere else in the document. // Otherwise it causes space to appear at the top and bottom of elements // that are clearfixed. // 2. The use of `table` rather than `block` is only necessary if using // `:before` to contain the top-margins of child elements. // // Source: http://nicolasgallagher.com/micro-clearfix-hack/ .clearfix() { &::before, &::after { content: " "; // 1 display: table; // 2 } &::after { clear: both; } } .img-responsive(@display: block) { display: @display; max-width: 100%; // Part 1: Set a maximum relative to the parent height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching } // Retina image // // Short retina mixin for setting background-image and -size. Note that the // spelling of `min--moz-device-pixel-ratio` is intentional. /* stylelint-disable */ .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) { background-image: url("@{file-1x}"); @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { background-image: url("@{file-2x}"); background-size: @width-1x @height-1x; } } /* stylelint-enable */ // Center-align a block level element .center-block() { display: block; margin-left: auto; margin-right: auto; } // Responsive utilities // // More easily include all the states for responsive-utilities.less. .responsive-visibility() { display: block !important; table& { display: table !important; } tr& { display: table-row !important; } th&, td& { display: table-cell !important; } } .responsive-invisibility() { display: none !important; } // Box sizing .box-sizing(@boxmodel) { -webkit-box-sizing: @boxmodel; -moz-box-sizing: @boxmodel; box-sizing: @boxmodel; } // Only display content to screen readers .sr-only() { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap; }