Den Dribbles

Hello Shave

October 15, 2018

Have you ever run into the issue of grids breaking when content input is too long? While there are a number of solutions to restraining height on elements, one that I like comes in Shave from the Dollar Shave Club.

Installation

# npm
npm install --save shave
# or yarn
yarn add shave

Usage

Incredibly simple.

// code omitted for brevity
import shave from "shave"

// restrain height to 70px
const selector = ".shave"
const height = 70
shave(selector, height)

Before vs after

Issue beforehand

Issue after

Hello is a series that is about short, sharp examples. Read more on this series to find small gems to add your toolset.


A personal blog on all things of interest. Written by Dennis O'Keeffe, Follow me on Twitter