Introduction to <wbr>tag

The <wbr>tag in HTML stands for "Word Break Opportunity." It is a useful element when dealing with long words or URLs in your content that might not naturally break within a line, especially in responsive web designs or when the text container's width is limited. The <wbr>tag does not produce any visible output or affect the text's appearance but provides a hint to the browser about where it can safely break the line.

Copy to clipboard
<!DOCTYPE html>
    <html lang="en">
    <head>
      <!-- Basic Meta Tags -->
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="A modern HTML document showcasing various styled elements with HD video.">
      
      <!-- Title of the Page -->
      <title>title of <wbr> tag</title>
    </head>
    <body>
    
      <!-- Section Container -->
      <div class="section">
        <!-- Time Example -->
        <p>Event Date: <time class="custom-time" datetime="2024-12-25T09:00">December 25, 2024, at 9:00 AM</time></p>
      </div>
    
      <!-- Section Container -->
      <div class="section">
        <!-- Underlined Text Example -->
        <p>This is an example of <u class="custom-u">underlined text</u> for emphasis.</p>
      </div>
    
      <!-- Section Container -->
      <div class="section">
        <!-- Unordered List Example -->
        <ul class="custom-ul">
          <li>Introduction to HTML</li>
          <li>CSS Basics and Flexbox</li>
          <li>JavaScript for Beginners</li>
        </ul>
      </div>
    
      <!-- Section Container -->
      <div class="section">
        <!-- Variable Example -->
        <p>The area of a circle is A = <var class="custom-var">πr<sup>2</sup></var></p>
      </div>
    
      <!-- Section Container with HD Video -->
      <div class="section">
        <!-- Video with Track Example -->
        <video class="custom-video" controls poster="https://www.example.com/video-thumbnail.jpg">
          <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
          <source src="https://www.example.com/video_hd.mp4" type="video/mp4">
          <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
          <track src="subtitles_fr.vtt" kind="subtitles" srclang="fr" label="French">
          Your browser does not support the video tag.
        </video>
      </div>
    
      <!-- Section Container -->
      <div class="section">
        <!-- Word Break Example -->
        <p>Thisisaverylongwordwithout<wbr>anyspacesandneedsbreaking.</p>
      </div>
    
    </body>
    </html>
Copy to clipboard
body {
      font-family: 'Roboto', sans-serif;
      background: linear-gradient(135deg, #f0f4f8, #ffffff);
      color: #333;
      margin: 0;
      padding: 20px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      animation: gradientShift 15s ease infinite;
    }
    
    /* Keyframes for Gradient Animation */
    @keyframes gradientShift {
      0% { background-position: 0% 50%; }
      50% { background-position: 100% 50%; }
      100% { background-position: 0% 50%; }
    }
    
    /* Section Container */
    .section {
      width: 100%;
      max-width: 1000px;
      margin: 20px 0;
      padding: 20px;
      background-color: #ffffff;
      border-radius: 12px;
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
      transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    
    .section:hover {
      transform: translateY(-5px);
      box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    }
    
    /* CSS for Time */
    .custom-time {
      font-weight: bold;
      color: #007bff;
      background-color: #e8f0fe;
      padding: 6px 10px;
      border-radius: 6px;
      transition: background-color 0.3s ease;
    }
    
    .custom-time:hover {
      background-color: #d0e7ff;
    }
    
    /* CSS for Video */
    .custom-video {
      width: 100%;
      max-width: 800px;
      margin: 20px auto;
      display: block;
      border-radius: 12px;
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
      transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    
    .custom-video:hover {
      transform: scale(1.02);
      box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    }
    
    /* CSS for Underlined Text */
    .custom-u {
      text-decoration: underline;
      text-decoration-color: #ff6e7f;
      text-decoration-style: wavy;
      font-size: 1.2rem;
      transition: color 0.3s ease;
    }
    
    .custom-u:hover {
      color: #ff6e7f;
    }
    
    /* CSS for Unordered List */
    .custom-ul {
      list-style-type: none;
      padding-left: 0;
      font-size: 1.1rem;
      color: #333;
    }
    
    .custom-ul li {
      margin: 12px 0;
      padding: 10px 15px;
      position: relative;
      background-color: #e9f5ff;
      border-radius: 8px;
      transition: background-color 0.3s ease;
    }
    
    .custom-ul li:hover {
      background-color: #d0e7ff;
    }
    
    .custom-ul li:before {
      content: '✔';
      position: absolute;
      left: 10px;
      color: #007bff;
      font-weight: bold;
    }
    
    /* CSS for Variable */
    .custom-var {
      font-style: italic;
      color: #d9534f;
      background-color: #fdecea;
      padding: 4px 8px;
      border-radius: 4px;
      transition: background-color 0.3s ease;
    }
    
    .custom-var:hover {
      background-color: #f8d7da;
    }
    
    /* CSS for Word Break */
    p {
      font-size: 1.1rem;
      line-height: 1.6;
      text-align: center;
      margin: 20px 0;
    }

Global Attributes

AttributesDescription
accesskeySpecifies a shortcut key to activate or focus an element.
autocapitalizeControls whether and how text input is automatically capitalized.
classSpecifies one or more class names for the element, allowing CSS styling and JavaScript manipulation.
contenteditableSpecifies whether the content of an element is editable or not.
contextmenuSpecifies a context menu for the element.
dirDefines the text direction. Possible values are "ltr" (left-to-right), "rtl" (right-to-left), and "auto".
draggableSpecifies whether an element is draggable. Possible values are "true" or "false".
enterkeyhintSpecifies the action label or icon to be shown for the enter key on virtual keyboards.
hiddenIndicates that the element is not yet, or is no longer, relevant. The browser does not display elements that have the `hidden` attribute set.
idSpecifies a unique identifier for the element.
inputmodeProvides a hint to browsers for which virtual keyboard configuration to use when editing this element or its descendants.
isAllows you to specify the type of custom element.
langSpecifies the language of the element's content.
nonceA cryptographic nonce ("number used once") that can be used by Content Security Policy (CSP) to determine whether or not a given fetch will be allowed to proceed.
partSpecifies the element’s part in the shadow DOM.
slotAssigns a slot in a shadow DOM shadow tree.
spellcheckIndicates whether the element is subject to spell checking.
styleProvides inline CSS styling for the element.
tabindexSpecifies the tab order of the element.
titleAdds extra information about the element, displayed as a tooltip when hovering over the element.
translateSpecifies whether the content of the element should be translated. Possible values are "yes" or "no".
HTML AttributesGlobal AttributesEvent Attributes
To view the full list
To view the full list
To view the full list
elementsChrome BrowsersMicrosoft Edge BrowserFirefox BrowsersSafari BrowserOpera Browser
<wbr>1.012.03.04.011.7