Explain the use of the hyphens Property in CSS
Last Updated :
02 Feb, 2024
The hyphens
Property in CSS is used to control the hyphenation of text within an element. It allows you to specify how words should be hyphenated when they extend beyond the width of their container, improving the visual appearance of justified text.
Note: The hyphens
property can take values like none
, manual
, and auto
.
Syntax:
/* Disabling hyphenation */
p {
hyphens: none;
}
/* Enabling automatic hyphenation */
.article {
hyphens: auto;
lang: en; /* Language code for English */
}
Features:
The features of hyphens
property are as follows:
none
: It disables hyphenation.
manual
: It suggests hyphenation points using soft hyphens (­
), allowing manual control.
auto
: It enables automatic hyphenation based on language rules.
Share your thoughts in the comments
Please Login to comment...