monks/line_clamp

The line-clamp CSS property allows limiting of the contents of a {{Glossary(“block”)}} to the specified number of lines.

For legacy support, the vendor-prefixed -webkit-line-clamp property only works in combination with the {{cssxref(“display”)}} property set to -webkit-box or -webkit-inline-box and the {{cssxref(“box-orient”, “-webkit-box-orient”)}} property set to vertical. Despite these prefixed properties being deprecated, the co-dependency of these three properties is a fully specified behavior and will continue to be supported.

In most cases you will also want to set {{cssxref(“overflow”)}} to hidden, otherwise the contents won’t be clipped but an ellipsis will still be shown after the specified number of lines.

When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end.

Values

pub const inherit: #(String, String)
pub const initial: #(String, String)
pub const none: #(String, String)
  • : This value specifies that the content won’t be clamped.
pub fn raw(value: String) -> #(String, String)

Enter a raw string value for line-clamp

pub const revert: #(String, String)
pub const revert_layer: #(String, String)
pub const unset: #(String, String)
pub fn var(variable: String) -> #(String, String)

Enter a variable name to be used for line-clamp. It will be wrapped in var() and have -- prepended.

Search Document