Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Stylus mixin for clamping multiline text

NotificationsYou must be signed in to change notification settings

zinoroman/LineClamping.styl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM versionNPM downloadsDependency StatusDev Dependency Status

line-clamping.styl

Stylus mixin for clamping multiline text

Get started

Installation

You can installline-clamping.styl usingnpm

npm i line-clamping.styl --save-dev

or you can useyarn

yarn add line-clamping.styl --dev

Importing

Using gulp

Import the installed package fromnode_modules

importlineClampingfrom'line-clamping.styl';

Add it touse array for stylus

stylus({use:[lineClamping()],})

That's all! Now you are ready to useline-clamping.styl

API

line-clamping mixin takes 1 argument:

line-clamping(options:I-line-clamping|number)

Available options

interface I-line-clamping {lines:number,line-height?:cssunit,font-size?:cssunit,is-inline?:boolean}

For example, if you need to create block.block that should have two lines of the text,line-height: 2 andfont-size: 20px then the code will be following:

.blockline-clamping({lines:2,line-height:2,font-size:20px,})

If you want to useis-inline mode you must setwidth property for the element.

.inline-blockwidth200pxline-clamping({lines:2,line-height:2,font-size:20px,is-inline:true})

You can find more examples of usageline-clamping() intest folder

Testing

First of all you need to install the dependencies:

yarn

After installation run following command:

yarntest

About

Stylus mixin for clamping multiline text

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp