All Projects → madeleineostoja → Postcss Responsive Type

madeleineostoja / Postcss Responsive Type

Automagical responsive typography, built on PostCSS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Postcss Responsive Type

Container Query
A PostCSS plugin and Javascript runtime combination, which allows you to write container queries in your CSS the same way you would write media queries.
Stars: ✭ 119 (-67.22%)
Mutual labels:  responsive, postcss, postcss-plugin
postcss-gtk
Processes GTK+ CSS into browser CSS
Stars: ✭ 23 (-93.66%)
Mutual labels:  postcss, postcss-plugin
postcss-windicss
PostCSS integrations for Windi CSS
Stars: ✭ 33 (-90.91%)
Mutual labels:  postcss, postcss-plugin
postcss-lazyimagecss
A PostCSS plugin that generates images's CSS width & height properties automatically.
Stars: ✭ 38 (-89.53%)
Mutual labels:  postcss, postcss-plugin
postcss
No description or website provided.
Stars: ✭ 59 (-83.75%)
Mutual labels:  postcss, postcss-plugin
postcss-purgecss
PostCSS plugin for purgecss
Stars: ✭ 92 (-74.66%)
Mutual labels:  postcss, postcss-plugin
postcsslayouts
This is the repository for my course, Building a Responsive Single-Page Design with PostCSS on LinkedIn Learning and Lynda.com.
Stars: ✭ 22 (-93.94%)
Mutual labels:  postcss, responsive
postcss-inline-media
Media queries shortcut, built on PostCSS, example: font-size: 20px @1200 18px @480 16px;
Stars: ✭ 47 (-87.05%)
Mutual labels:  postcss, postcss-plugin
postcss-define-function
PostCSS plugin for Sass-like function directive
Stars: ✭ 25 (-93.11%)
Mutual labels:  postcss, postcss-plugin
postcss-typed-css-classes
PostCSS plugin that generates typed entities from CSS classes for chosen programming language.
Stars: ✭ 12 (-96.69%)
Mutual labels:  postcss, postcss-plugin
postcss-aspect-ratio
A PostCSS plugin to fix an element's dimensions to an aspect ratio.
Stars: ✭ 38 (-89.53%)
Mutual labels:  postcss, postcss-plugin
postcss-rename
Replace class names based on a customizable renaming scheme.
Stars: ✭ 77 (-78.79%)
Mutual labels:  postcss, postcss-plugin
postcss-critical-css
PostCSS plugin to define and output critical CSS using custom atRules, and/or custom CSS properties. Critical CSS may be output to one or more files, as defined within the plugin options or within the CSS.
Stars: ✭ 84 (-76.86%)
Mutual labels:  postcss, postcss-plugin
postcss-prefixwrap
A PostCSS plugin that is used to wrap css styles with a css selector to constrain their affect on parent elements in a page.
Stars: ✭ 54 (-85.12%)
Mutual labels:  postcss, postcss-plugin
postcss-styl
PostCSS parser plugin for converting Stylus syntax to PostCSS AST.
Stars: ✭ 15 (-95.87%)
Mutual labels:  postcss, postcss-plugin
postcss-font-pack
PostCSS plugin to simplify font declarations by validating only configured font packs are used and adding fallbacks.
Stars: ✭ 18 (-95.04%)
Mutual labels:  postcss, postcss-plugin
postcss-relaxed-unit
🍮Postcss-relaxed-unit is a postcss plugin for unit tranformation and make write css easier with custom unit.
Stars: ✭ 44 (-87.88%)
Mutual labels:  postcss, postcss-plugin
postcss-center
PostCSS plugin to center elements.
Stars: ✭ 44 (-87.88%)
Mutual labels:  postcss, postcss-plugin
postcss-import-url
PostCSS plugin inlines remote files.
Stars: ✭ 47 (-87.05%)
Mutual labels:  postcss, postcss-plugin
postcss-clean
PostCss plugin to minify your CSS with clean-css
Stars: ✭ 41 (-88.71%)
Mutual labels:  postcss, postcss-plugin

PostCSS Responsive Type

NPM version NPM downloads Build Status

Generate automagical fluid typography, with new responsive properties for font-size, line-height, and letter-spacing. Built on PostCSS.

Responsive Type Demo

Inspired by this post.

Part of Rucksack - CSS Superpowers

Contents

Usage

Quick start

html {
  font-size: responsive;
}

Pro tip: set a reaponsive font-size on html and use rem units throughout your project to make your whole UI fluid

Specify parameters

Units can be in px, rem, or em. When using em units, be sure that the font-range is specified in em as well.

html {
  font-size: responsive 12px 21px; /* min-size, max-size */
  font-range: 420px 1280px; /* viewport widths between which font-size is fluid */
}

Expanded syntax

html {
  font-size: responsive;
  min-font-size: 12px;
  max-font-size: 21px;
  lower-font-range: 420px;
  upper-font-range: 1280px;
}

Responsive line-height and letter-spacing

PostCSS Responsive Type also allows you to set fluid sizes for the line-height and letter-spacing properties. They have the same syntax and work the same way as responsive font sizes.

html {
  line-height: responsive 1.2em 1.8em;
  line-height-range: 420px 1280px;

  /* or extended syntax: */
  line-height: responsive;
  min-line-height: 1.2em;
  max-line-height: 1.8em;
  lower-line-height-range: 420px;
  upper-line-height-range: 1280px;
}
html {
  letter-spacing: responsive 0px 4px;
  letter-spacing-range: 420px 1280px;

  /* or extended syntax: */
  letter-spacing: responsive;
  min-letter-spacing: 0px;
  max-letter-spacing: 4px;
  lower-letter-spacing-range: 420px;
  upper-letter-spacing-range: 1280px;
}

Note: Unitless line heights are not supported.

Defaults

To get started you only need to specify the responsive property, all other values have sane defaults.

font-size
  • min-font-size: 14px

  • max-font-size: 21px

  • lower-font-range: 420px

  • upper-font-range: 1280px

line-height
  • min-line-height: 1.2em

  • max-line-height: 1.8em

  • lower-line-height-range: 420px

  • upper-line-height-range: 1280px

letter-spacing
  • min-letter-spacing: 0px

  • max-letter-spacing: 4px

  • lower-letter-spacing-range: 420px

  • upper-letter-spacing-range: 1280px

Browser Support

postcss-responsive-type just uses calc, vw units, and media queries behind the scenes, so it works on all modern browsers (IE9+). Although Opera Mini is not supported.

Legacy browsers will ignore the output responsive font-size. You can easily provide a simple static fallback:

.foo {
  font-size: 16px;
  font-size: responsive;
}

MIT © Sean King

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].