项目作者: juliekoubova

项目描述 :
Beautifully aligned type with tailwind.css.
高级语言: HTML
项目地址: git://github.com/juliekoubova/tailwind-vertical-rhythm.git
创建时间: 2020-04-09T21:40:15Z
项目社区:https://github.com/juliekoubova/tailwind-vertical-rhythm

开源协议:

下载


Tailwind.css Vertical Rhythm

Beautifully aligned type with Tailwind.css.

Install

  1. npm install --save-dev tailwind-vertical-rhythm

—or—

  1. yarn add -D tailwind-vertical-rhythm

Configure tailwind.config.js

Use https://codepen.io/sebdesign/pen/EKmbGL?editors=0011 to calculate the cap
heights of your fonts.

  1. {
  2. // you can disable standard font size and line height classes and use vr-*
  3. // classes instead
  4. corePlugins: {
  5. fontSize: false,
  6. lineHeight: false
  7. },
  8. verticalRhythm: {
  9. defaultLineHeight: 'loose',
  10. fontCapHeight: {
  11. // Calculated using https://codepen.io/sebdesign/pen/EKmbGL?editors=0011
  12. 'default': 0.705,
  13. 'Open Sans': 0.72
  14. },
  15. height: 0.5 // Vertical rhythm in rems
  16. },
  17. plugins: [
  18. require('tailwind-vertical-rhythm')
  19. ]
  20. }

And now use .vr{-fontFamily?}-{lineHeight}-{fontSize} classes to set line height,
font size, and possibly non-default font family at the same time.

Also, there’s a .vr-debug class showing the vertical rhythm to see where
you’re not aligned.

Based on https://github.com/ceteio/styled-components-rhythm