LESS mixin to calculate a width
Published onA LESS mixin to calculate a width with a defined margin, vendor prefixed. Add a fallback in absolute size or %.
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
.calc-width(@margin, @fallback) { | |
width: @fallback; | |
width: -o-calc(~"100% - "@margin); | |
width: -webkit-calc(~"100% - "@margin); /** Safari 6, Chrome 19-25 **/ | |
width: -moz-calc(~"100% - "@margin); /** FF 4-15 **/ | |
width: calc(~"100% - "@margin); /** FF 16+, IE 9+, Opera 15, Chrome 26+, Safari 7 and future other browsers **/ | |
/* See http://caniuse.com/#search=calc for known issues with calc */ | |
} |