Advertisement
Guest User

Dynamic letter-spacing with LESS based on font-size

a guest
Jul 21st, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.50 KB | None | 0 0
  1. .letter-spacing (@letter-spacing) when (@font-size >= 36px) {
  2.     letter-spacing: -2px;
  3. }
  4.  
  5. .letter-spacing (@letter-spacing) when (@font-size < 36px) {
  6.     letter-spacing: 0px;
  7. }
  8.  
  9. .font-size (@font-size: @baseFontSize) {
  10.     @pxFontValue: (@font-size / @baseFontSize);
  11.     @pxLineHeightValue: (@font-size / @baseFontSize) * 1.5;
  12.     font-size: @font-size * 1px;
  13.     line-height: @font-size * 1.5 * 1px;
  14.     font-size: ~"@{pxFontValue}rem";
  15.     line-height: ~"@{pxLineHeightValue}rem";
  16.     .letter-spacing(@font-size);   
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement