Molten Leading

Manually adjusting line-height with media queries for optimum readability across vast number of screen sizes can be hard. What makes it even harder, is, that instead of the screen width, the line-height should be relative to its container’s width and i…


This content originally appeared on Viljami Salminen and was authored by Viljami Salminen

Manually adjusting line-height with media queries for optimum readability across vast number of screen sizes can be hard. What makes it even harder, is, that instead of the screen width, the line-height should be relative to its container’s width and its font settings in order to achieve proper readability and appropriate spacing.

Thanks to @Wilto, there has been a jQuery plugin called “Molten Leading” around for quite some time already which makes it possible to automate this process and define a minimum width at which the adjustment starts, a maximum element width where it stops, and a minimum and maximum line-height to adjust through.

I wanted to use something similar in one of my latest projects, but I didn’t want to introduce new dependencies to external JavaScript libraries just because of this one feature. I also wanted something that would have a bit better performance, so I decided to write a custom version of Molten Leading without any library dependencies. All this is now available on GitHub too, so take a look and give it a spin.

Features #

  • Automatically adjust line-height based on element width.
  • Works in all browsers, including IE6 and up.
  • Uses requestAnimationFrame for the best possible performance.
  • Free to use in both commercial and non-commercial projects.
  • Doesn’t require external JavaScript libraries.
  • Supports px, em and rem CSS units.
  • Weighs only 1.17kb minified and Gzip’ed.
  • Supports multiple instances.

Responsive Line Height

Download #

Molten Leading on GitHub


This content originally appeared on Viljami Salminen and was authored by Viljami Salminen


Print Share Comment Cite Upload Translate Updates
APA

Viljami Salminen | Sciencx (2014-06-27T00:00:00+00:00) Molten Leading. Retrieved from https://www.scien.cx/2014/06/27/molten-leading/

MLA
" » Molten Leading." Viljami Salminen | Sciencx - Friday June 27, 2014, https://www.scien.cx/2014/06/27/molten-leading/
HARVARD
Viljami Salminen | Sciencx Friday June 27, 2014 » Molten Leading., viewed ,<https://www.scien.cx/2014/06/27/molten-leading/>
VANCOUVER
Viljami Salminen | Sciencx - » Molten Leading. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2014/06/27/molten-leading/
CHICAGO
" » Molten Leading." Viljami Salminen | Sciencx - Accessed . https://www.scien.cx/2014/06/27/molten-leading/
IEEE
" » Molten Leading." Viljami Salminen | Sciencx [Online]. Available: https://www.scien.cx/2014/06/27/molten-leading/. [Accessed: ]
rf:citation
» Molten Leading | Viljami Salminen | Sciencx | https://www.scien.cx/2014/06/27/molten-leading/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.