Created
August 22, 2013 06:55
Small and useful mixin to easily set width and height to your elements.
It can be used with any kind of unit or even with an image name so it gets the dimensions from the image.
See https://coderwall.com/p/2k3rgw for the full post.
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
@mixin size($x, $y: $x) { | |
@if type_of($x) == string { | |
width: image-width($x); | |
} @else { | |
width: $x; | |
} | |
@if type_of($y) == string { | |
height: image-height($y); | |
} @else { | |
height: $y; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment