Giter VIP home page Giter VIP logo

vertical-rhythm's Introduction

Vertical Rhythm

New in this version

  • All files can now be imported as a mixin.
  • Standard 6 font sizes (xs - xxl).
  • New calculations for typeface specific cap heights.
  • Baseline can now be toggled via a variable instead of a checkbox.
  • Fixed some bugs in the calculations.

A collection of examples that displays the effects of a proper vertical rhythm.

How it works

Base typography

The goal of typography is to create balanced, readable and legible text. Good typography depends on many factors.

VR takes into account the cap height of different typefaces. This is the only number that needs some fine-tuning to get everything just right. Located in: <_vr-user-settings.scss>

$show-baseline: true;

$font-display: Arial, sans-serif;
$cap-font-display: 0.0155em;

$px-font-size: 16;
$px-line-height: 24;

$modular-scale: 'golden section';

Modular scales

The next step is selecing one of the 17 predefined modular scales.

$modular-scales: (
  'minor-second': 1.067,
  'major-second': 1.125,
  'minor-third': 1.2,
  'major-third': 1.25,
  'perfect-fourth': 1.333,
  'augmented-fourth': 1.414,
  'perfect-fifth': 1.5,
  'minor-sixth': 1.6,
  'golden-section': 1.618,
  'major-sixth': 1.667,
  'minor-seventh': 1.778,
  'major-seventh': 1.875,
  'octave': 2,
  'major-tenth': 2.5,
  'major-eleventh': 2.667,
  'major-twelfth': 3,
  'double-octave': 4
);

Alignment

All alignment classes are based on the $rhythm ($base-font-size * $base-line-height).

div  { margin-bottom: $distance-s; }
h1   { @include vr($font-display, $font-size-m); }
code { padding: $paragraph-trailer; }
img  { max-height: $size-m; }

Borders

Use negative margins to align elements that have a top- and/or bottom border(s). Aligning borders might be a bit tricky at first, but eventually it becomes second nature.

.foo {
  margin-top: ($border-width-m * -1);
  border-top: $border-width-m solid $black;
}

.bar {
  margin-bottom: ($distance-s - $border-width-m);
  border-bottom: $border-width-m solid $black;
}

License

Vertical Rhythm is licensed under the MIT license.

vertical-rhythm's People

Watchers

James Cloos avatar Bryan Garzón Bahamón avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.