Last active
August 29, 2015 14:01
-
-
Save jnowland/b43cbb00549b308d6100 to your computer and use it in GitHub Desktop.
Attempting to set a negative margin-top of half height using sass maps. The units returning don't appear to be a string or integer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated from spritesmith via gulp | |
$sprites: ( | |
arrow-right-blue-withShadow: ( | |
x: 0px, | |
y: 114px, | |
offset_x: 0px, | |
offset_y: -114px, | |
width: 13px, | |
height: 19px, | |
total_width: 239px, | |
total_height: 799px, | |
image: '../img/icon-sprite.png' | |
), | |
arrow-right-white-withShadow: ( | |
x: 0px, | |
y: 233px, | |
offset_x: 0px, | |
offset_y: -233px, | |
width: 13px, | |
height: 19px, | |
total_width: 239px, | |
total_height: 799px, | |
image: '../img/icon-sprite.png' | |
), | |
club-evolution-191x40: ( | |
x: 0px, | |
y: 596px, | |
offset_x: 0px, | |
offset_y: -596px, | |
width: 191px, | |
height: 40px, | |
total_width: 239px, | |
total_height: 799px, | |
image: '../img/icon-sprite.png' | |
), | |
); | |
@function sprite($sprite, $attribute) { | |
@return map-get(map-get($sprites, $sprite), $attribute), | |
} | |
/* */ | |
$iconHeightSprite: sprite(arrow-right-blue-withShadow , 'height'); | |
/* | |
Failed attempts: | |
@function strip-units($number) { | |
@return $number / ($number * 0 + 1); | |
} | |
$iconHeightSprite: unquote($iconHeightSprite); | |
@warn strip-units( $iconHeightSprite ); // error scss/example.scss (Line 50: Undefined operation: "19px times 0".) | |
*/ | |
$iconHalfHeight: $iconHeightSprite/2; | |
.example { | |
margin-top: $iconHalfHeight; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment