Open In App

How to define a possible line-break using HTML?

Last Updated : 25 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

To define a possible line-break in HTML use a <wbr> element. It stands for word break opportunity and is used to define the position within the text which is treated as a line break by the browser. It is mostly used when the used word is too long and there are chances that the browser may break lines at the wrong place for fitting the text.

Syntax:

<wbr>
// Contents
</wbr>

Example 1: The example shows how to define a possible line-break using HTML5.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        How to define a possible line-break using HTML5?
    </title>

    <style>
        body {
            text-align: center;
        }
    </style>
</head>

<body>
    <h2>
        How to define a possible line-break
    </h2>

    <p>
        GFG stands for GeeksforGeeks and it is
      <wbr> 
      a computer science portal for geeks.
    </p>
    <p>
        wbr element is a 
      	veryveryveryveryveryveryveryveryveryveryvery
      <wbr>longword that will break at specific<wbr> 
      places when the browser window is resized.
    </p>
    <b>By using the CSS property</b>
</body>

</html>

Output:

impii1

Output

Example 2: The example shows how to define a possible line-break using HTML5.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        How to define a possible
        line-break using HTML5
    </title>

    <style>
        body {
            text-align: center;
        }
    </style>
</head>

<body>
    <h2>
        HTML5: How to defines
        a possible line-break?
    </h2>

    <!-- br tag is used here -->
    <p>
        GeeksforGeeks: <br>
        Computer science portal
    </p>
</body>

</html>

Output:

impii2

Output



Next Article

Similar Reads