Advertisement
matthillco

PX->EM mixin for fonts in LESS

Jun 1st, 2012
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.45 KB | None | 0 0
  1. /* Base font, 10px = 1em */
  2. body {
  3.   font-size: 62.5%;
  4. }
  5.  
  6. /* LESS */
  7. .text-heading (@weight: 500, @size: 26, @line: 34){
  8.     @font-size: @size/10;
  9.     @font-line: (@line/@size);
  10.     font:@weight ~'@{font-size}em'~'/'~'@{font-line}em' Arial,sans-serif;
  11.     text-rendering:optimizeLegibility;
  12. }
  13.  
  14. /* How to use */
  15.  
  16. h1 {
  17.     .text-heading(bold,24,36)
  18. }
  19.  
  20. /* Output */
  21.  
  22. h1 {
  23.   font: bold 2.4em / 1.5em Arial, sans-serif;
  24.   text-rendering: optimizeLegibility;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement