Skip to content

Commit

Permalink
Merge pull request #23 from kni-labs/ratio-box-additions
Browse files Browse the repository at this point in the history
ratio box niceties via @corysimmons, address #22
  • Loading branch information
dbox committed Feb 23, 2016
2 parents baa5d6d + e416978 commit d7fcfd2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pages
Submodule .pages updated from 46cd30 to efa5b5
2 changes: 1 addition & 1 deletion .scss-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ linters:
enabled: true
allow_single_line_rule_sets: true
SingleLinePerSelector:
enabled: true
enabled: false
SpaceAfterComma:
enabled: true
SpaceAfterPropertyColon:
Expand Down
16 changes: 11 additions & 5 deletions knapsack/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,28 @@
/// This sets a specific width/height ratio. Useful on background images,
/// iframes and Youtube embeds.
///
/// **note**: Any content inside `ratio-box` will need to be positioned
/// absolutely as not to change the aspect-ratio.
///
/// @param {variable} $ratio [1 / 1] - Aspect ratio: height / width
/// @param {variable} $bg-color [$base-gray, .2] - placeholder background color
/// @group layout
/// @example
/// figure {
/// @include ratio(16 / 9);
/// }
/// @link https://www.mademyday.de/css-height-equals-width-with-pure-css.html

@mixin ratio-box($ratio: 1 / 1) {
@mixin ratio-box($ratio: 1 / 1, $bg-color: rgba($base-gray, .15)) {
background-color: $bg-color;
overflow: hidden;
position: relative;

> * {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}

&:before {
content: '';
display: block;
Expand Down Expand Up @@ -78,7 +85,6 @@
/// }
/// @link https://codepen.io/dbox/pen/OyzrrV


@mixin full-page($height: 100vh, $max-height: 850px, $min-height: 600px, $breakpoint: 768px) {
// Disable below set breakpoint
@if ($breakpoint) {
Expand Down

0 comments on commit d7fcfd2

Please sign in to comment.