Open In App

Primer CSS Typography Word-Break

Last Updated : 11 May, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by object-oriented CSS principles, functional CSS, and BEM architecture. It is highly reusable and flexible. It is created with GitHub’s design system.

Primer CSS Typography Word-Break is used to break the lines and words of the text when the width of the line exceeds the container. There are two types of breaking the word. Use the wb-break-word class to break only the long words when they exceed the length of the line. Use the wb-break-all class to break all the words when the words meet the end of the line. 

In this article, we will discuss Primer CSS Typography Word-Break.

Primer CSS Typography Word-Break classes:

  • wb-break-word: This class is used to break only long words.
  • wb-break-all: This class is used to break all the words that meet the end of the line.

Syntax:

<p class="Word-Break-Class">
    ...
</p>

Example 1: This example demonstrates the implementation of Primer CSS Typography Word-Break using the wb-break-word class.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title> Primer CSS Typography Word-Break </title>
    <link rel="stylesheet" href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css" /> 
</head>
  
<body class="m-2">
    <h1 class="color-fg-success"
        GeeksforGeeks 
    </h1>
    <h3
        Primer CSS Typography Word-Break 
    </h3> <br>
  
    <p class="wb-break-word col-2 border">
        A Computer Science portal for geeks.
        It contains well written, well thought
        and well explained computer science and
        programming articles.
    </p>
  
</body>
  
</html>


Output:

 

Example 2: This example demonstrates the implementation of Primer CSS Typography Word-Break using the wb-break-all class.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title> Primer CSS Typography Word-Break </title>
    <link rel="stylesheet" href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css" /> 
</head>
  
<body class="m-2">
    <h1 class="color-fg-success"
        GeeksforGeeks 
    </h1>
    <h3
        Primer CSS Typography Word-Break 
    </h3> <br>
  
    <p class="wb-break-all col-2 border">
        A Computer Science portal for geeks.
        It contains well written, well thought
        and well explained computer science and
        programming articles.
    </p>
  
</body>
  
</html>


Output:

 

Reference: https://primer.style/css/utilities/typography#word-break



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads