Skip to content

Instantly share code, notes, and snippets.

View LoicGoyet's full-sized avatar

Loïc Goyet LoicGoyet

View GitHub Profile
@LoicGoyet
LoicGoyet / get-diff-to-align.scss
Last active March 8, 2016 09:31
A sass function that returns a value to apply to a margin in order to vertically or horizontally align two elements.
/// Contexts
/// @author Loïc Goyet
/// @param {Unit} $element1
/// @param {Unit} $element2
/// @param {Bool} $invert
/// @warn the params $big-element & $small-element must share the same type of
/// unit
@function get-diff-to-align($element1, $element2, $invert: true) {
$big-element: if($element1 > $element2, $element1, $element2);
$small-element: if($element1 > $element2, $element2, $element1);