79189611

Date: 2024-11-14 16:23:09
Score: 1.5
Natty:
Report link

I've found a solution using the <wbr> element and a little bit of JavaScript.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr

Here is the code :

let element = document.getElementById("paragraph"); // Get the element
let width = element.offsetWidth; // Get the current width of the element
element.style.width = width - 1 + "px"; // Set the new width to be the original width minus 1px
#paragraph {
  white-space: nowrap; 
  width: fit-content
}
<p id="paragraph">
  one two<wbr /> three four
</p>

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: jojubluch