Using CSS var for line-clamp #10446
Replies: 2 comments 1 reply
-
As per the documentation, you should be able to add the CSS variable as a value: // tailwind.config.js
module.exports = {
theme: {
extend: {
lineClamp: {
'read-more': 'var(--read-more-line-clamp, 2)',
},
},
},
plugins: [
require('@tailwindcss/line-clamp'),
],
}; Which would then produce the |
Beta Was this translation helpful? Give feedback.
-
Using CSS var for line-clamp is a way to simplify and make your code more readable by creating a reusable variable for the line-clamp property. Instead of repeating the same line-clamp value multiple times, you can define a CSS var with the desired value and use it throughout your code. This allows for easier changes and updates, as you only have to change the value in one place. |
Beta Was this translation helpful? Give feedback.
-
Hey guys! When using Stimulus Read More I noticed that they use a CSS variable
--read-more-line-clamp
to affect line clamp. Now, unfortunately this is not per se compatible with your line-clamp plugin. Still, I thought I'd ask if it wouldn't be an improvement if the plugin also used a CSS variable?Beta Was this translation helpful? Give feedback.
All reactions