Open In App

CSS hyphenate-limit-chars Property

The minimum word length and the minimum number of characters before and after the hyphen are both specified by the CSS hyphenate-limit-chars property.

You have detailed control over text hyphenation thanks to this attribute. Better typography is made possible by this option since it allows you to avoid problematic hyphenations and establish the right hyphenation for many languages.



Syntax:

/* Numeric values */
hyphenate-limit-chars: 5 2 2;
hyphenate-limit-chars: 5 2;
hyphenate-limit-chars: 5;

/* Keyword values */
hyphenate-limit-chars: auto auto auto;
hyphenate-limit-chars: auto auto;
hyphenate-limit-chars: auto;

/* Mixed values */
hyphenate-limit-chars: 5 auto 2;
hyphenate-limit-chars: 5 auto;
hyphenate-limit-chars: auto 2;

/* Global values */
hyphenate-limit-chars: inherit;
hyphenate-limit-chars: initial;

Default Value:



Property Values:  

Example 1: This example describes how the hyphenate-limit-chars property works.




<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        p {
          hyphens: auto;
          hyphenate-limit-chars: 5 2 2;
        }
    </style>
</head>
<body>
    <h1 style="color:green;">GeeksforGeeks</h1>
    <h2>hyphenate-limit-chars Property</h2>
    <div>Content 1</div
    <p>The minimum word length and the minimum number of characters 
        before and after the hyphen are both specified by 
        the hyphenate-limit-chars CSS property.</p>
</body>
</html>

Output:

 

Example 2:  In this example, we are using auto as the value for the hyphenate-limit-chars property.




<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        p {
          hyphens: auto;
          hyphenate-limit-chars: auto auto auto;
        }
    </style>
</head>
<body>
    <h1 style="color: green;">GeeksforGeeks</h1>
    <h2>hyphenate-limit-chars Property</h2>
    <div>Content 1</div
    <p>The minimum word length and the minimum number of 
        characters before and after the hyphen are both 
        specified by the hyphenate-limit-chars CSS property.</p>
</body>
</html>

Output:

 

Supported Browsers: The browser supported by CSS | hyphenate-limit-chars property are listed below:  


Article Tags :