HTML5: How to defines a possible line-break?
Solution :
HTML Code:
<!DOCTYPE html><!-- Define document type as HTML -->
<html><!-- Begin HTML document -->
<head><!-- Start of document header -->
<meta charset="utf-8"><!-- Define character encoding -->
<title>How to defines a possible line-break</title><!-- Title of the HTML page -->
</head><!-- End of document header -->
<body><!-- Start of document body -->
<p>wbr element is a veryveryveryveryveryveryveryveryveryveryvery<wbr>longwordthatwillbreakatspecific<wbr>placeswhenthebrowserwindowisresized.</p>
<!-- Paragraph containing text with wbr elements -->
</body><!-- End of document body -->
</html><!-- End of HTML document -->
Explanation:
- The HTML code includes a paragraph (<p>) element.
- Inside the paragraph, the wbr element is used to define possible line breaks within a long word.
- When the browser window is resized, the browser will break the long word at the specified <wbr> elements, allowing for better readability without affecting the overall layout of the page.
Live Demo:
See the Pen wbr-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/html-css-exercise/basic/wbr-answer.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics