Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Truncate multi-line text in a DOM element.
line-height
in pixels.-webkit-line-clamp
.em
, strong
, etc.).<div class="line-clamp-wrapper">
<div class="line-clamp">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</div>
.line-clamp-wrapper {
height: 60px;
overflow: hidden;
}
.line-clamp {
width: 100px;
line-height: 20px;
overflow-wrap: break-word;
word-wrap: break-word;
}
import lineClamp from 'line-clamp';
lineClamp(element, { lineCount: 3 });
To run the example, do:
$ git clone https://github.com/yuanqing/line-clamp
$ npm install
$ npm install --global gulp
$ gulp example --open
import lineClamp from 'line-clamp';
element
— A DOM element.
options
— An object literal:
Key | Description | Default |
---|---|---|
ellipsisCharacter | The string to append to the truncated text. | \u2026 |
lineCount | Required. The number of lines to show. | undefined |
See Usage above for the accompanying CSS.
Install via npm:
$ npm i --save line-clamp
FAQs
Line clamp a DOM element in vanilla JavaScript
The npm package line-clamp receives a total of 4,118 weekly downloads. As such, line-clamp popularity was classified as popular.
We found that line-clamp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.