All Projects → paulradzkov → bettertext.css

paulradzkov / bettertext.css

Licence: MIT license
Improved default typography for naked HTML or Markdown-generated content.

Programming Languages

CSS
56736 projects
coffeescript
4710 projects

Projects that are alternatives of or similar to bettertext.css

Vertical Rhythm
Put some typographical vertical rhythm in your CSS. LESS, Stylus and SCSS/SASS versions included.
Stars: ✭ 83 (+130.56%)
Mutual labels:  typography, stylesheet
React Native Style Tachyons
Better styling for React Native
Stars: ✭ 640 (+1677.78%)
Mutual labels:  typography, stylesheet
typography-karaoke
Demonstrating Typography via Karaoke-style cues using HTML5 Audio/Video and WebVTT
Stars: ✭ 15 (-58.33%)
Mutual labels:  typography
json-as-xlsx
Create excel from json npm package
Stars: ✭ 103 (+186.11%)
Mutual labels:  npm-module
fdiff
An OpenType table diff tool for fonts. Based on the fontTools TTX format.
Stars: ✭ 33 (-8.33%)
Mutual labels:  typography
windows-registry-node
Read and Write to the Windows registry in-process from Node.js. Easily set application file associations and other goodies.
Stars: ✭ 105 (+191.67%)
Mutual labels:  npm-module
harfpy
Python wrapper for HarfBuzz
Stars: ✭ 29 (-19.44%)
Mutual labels:  typography
responsive type
A one size fits all responsive type solution. Demo: https://codepen.io/kylevilleneuve/pen/XqeVdZ
Stars: ✭ 53 (+47.22%)
Mutual labels:  typography
ekzo
💫 Functional Sass framework for rapid and painless development
Stars: ✭ 32 (-11.11%)
Mutual labels:  typography
theme-ui-native
Build consistent, themeable React Native apps based on constraint-based design principles
Stars: ✭ 67 (+86.11%)
Mutual labels:  typography
rebass
⚛️ React primitive UI components built with styled-system.
Stars: ✭ 7,844 (+21688.89%)
Mutual labels:  typography
superglue
A productive library for Classic Rails, React and Redux
Stars: ✭ 106 (+194.44%)
Mutual labels:  npm-module
standard-components
A specification for functional UI components
Stars: ✭ 52 (+44.44%)
Mutual labels:  typography
extension-generator
This package is no longer supported. Please use https://github.com/flarum/cli instead.
Stars: ✭ 53 (+47.22%)
Mutual labels:  npm-module
eslint-plugin-gridsome
ESLint plugin for Gridsome
Stars: ✭ 45 (+25%)
Mutual labels:  npm-module
python freetype
Python language binding for FreeType library
Stars: ✭ 20 (-44.44%)
Mutual labels:  typography
simple-load-script
Very simple promise based script loader and JSONP
Stars: ✭ 13 (-63.89%)
Mutual labels:  npm-module
drawingwithcode
Drawing with code 😘
Stars: ✭ 28 (-22.22%)
Mutual labels:  typography
php-typography
A PHP library for improving your web typography.
Stars: ✭ 63 (+75%)
Mutual labels:  typography
responsive-modular-scale.css
Responsive typography using CSS variables
Stars: ✭ 19 (-47.22%)
Mutual labels:  typography

bettertext.css

npm version bower version FOSSA Status

Improved typography styles for naked HTML (without any classnames) and Markdown-generated content. Demo page

Install

npm install bettertext.css --save-dev

bower install bettertext.css --save

or use compiled version from CDN

  • https://unpkg.com/bettertext.css@latest/bettertext.css  
  • https://unpkg.com/bettertext.css@latest/bettertext.min.css  
  • https://unpkg.com/bettertext.css@latest/bettertext.min.css.map

Usage in HTML

Insert bettertext.css after normalize.css and after your @font-face declaration.

Or include bettertext.less into your project styles.

Default values

Component has global mixin with settings named .bettertext-settings(); and global variable bettertext which contains all the code.

Default settings:

.bettertext-settings() {

    //settings
    @fz: 16px;                         // default font-size in px
    @rythm: 24px;                      // vertical rythm = line-height in pixels
    @fz-small: 12px;                   // smaller font-size (px)
    @linel: 50rem;                     // max-width for text (any css value)
    @font-body: sans-serif;            // body
    @font-headers: sans-serif;         // headers
    @font-code: monospace, monospace;  // code (duplication is intentional)
    @scale1: 1.125;                    // header size multiplier for small screens
    @scale2: 1.250;                    // header size multiplier for large screens

    // margin for body, articles and sections (any css value)
    @structure-margin: ~"calc(24px + 3vw)" 5vw;

    // breakpoint to switch from 'mobile' to 'desktop'
    @bettertext-breakpoint: ~"(min-width: 768px)";

    //calculations
    // ...
}

Usage in LESS

Running with default parameters:

@import (less) "node_modules/bettertext.css/bettertext.less";

Setting up basic parameters:

@import (less) "node_modules/bettertext.css/bettertext.less";

.bettertext-settings() {

    //settings
    @fz: 16px;                          // default font-size
    @font-body: 'Arial', sans-serif;    // body
    @font-headers: 'Georgia', serif;    // headers

    @bettertext-breakpoint: ~"(min-width: 50em)"; // large screens starts from that value

}

Deep customization: you able to redefine any formula in calculation section inside bettertext-settings mixin.

@import (less) "node_modules/bettertext.css/bettertext.less";

.bettertext-settings() {

    //settings
    @fz: 16px;                          // default font-size
    @font-body: 'Arial', sans-serif;    // body
    @font-headers: 'Georgia', serif;    // headers

    @bettertext-breakpoint: ~"(min-width: 50em)"; // large screens starts from that value

    //redefining header margin-top
    @h1-mt: 3em;
    @h2-mt: 2.5em;
    @h3-mt: 2em;
    @h4-mt: 1.5em;
    @h5-mt: unit((2 * @lh * @fz / @h5-fz), em);
    @h6-mt: unit((2 * @lh * @fz / @h6-fz), em);
}

Customizing without LESS

If you are not using LESS on your project you can fork and customize bettertext.css on codepen: adjust settings with your parameters, test with your HTML or Markdown, press "View Compiled" and grab compiled CSS.

License

FOSSA Status

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].