Why isn’t the following text being collapsed into a ellipsis?

This is the code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full gap-4 grid-cols-8">
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg><span class="overflow-hidden text-ellipsis text-center text-xs">sssssssssssssss</span></div>
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg><span class="overflow-hidden text-ellipsis text-center text-xs">dummy.mib</span></div>
</div>
</code>
<code><div class="grid w-full gap-4 grid-cols-8"> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg><span class="overflow-hidden text-ellipsis text-center text-xs">sssssssssssssss</span></div> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg><span class="overflow-hidden text-ellipsis text-center text-xs">dummy.mib</span></div> </div> </code>
<div class="grid w-full gap-4 grid-cols-8">
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg><span class="overflow-hidden text-ellipsis text-center text-xs">sssssssssssssss</span></div>
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg><span class="overflow-hidden text-ellipsis text-center text-xs">dummy.mib</span></div>
</div>

The text breaks out of the container instead of being collapsed. Why is that, and how to fix it?

Tailwind Play

The text breaks out of the container

This is because sssssss... is a continuous word and does not force a line break by default. In Tailwind you can use break-all to make text break at any position.

And it seems you intend to implement text overflow ellipsis. In Tailwind you can just use line-clamp-* to achieve this effect directly.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full grid-cols-8 gap-4">
<div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path></svg
><span class="line-clamp-2 break-all text-center text-xs">ssssssssssssssssssssssssssssssssssssssssssssssssssssss</span>
</div>
<div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path></svg
><span class="line-clamp-2 break-all text-center text-xs">Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum, praesentium.</span>
</div>
</div>
</code>
<code><div class="grid w-full grid-cols-8 gap-4"> <div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path></svg ><span class="line-clamp-2 break-all text-center text-xs">ssssssssssssssssssssssssssssssssssssssssssssssssssssss</span> </div> <div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path></svg ><span class="line-clamp-2 break-all text-center text-xs">Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum, praesentium.</span> </div> </div> </code>
<div class="grid w-full grid-cols-8 gap-4">
  <div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path></svg
    ><span class="line-clamp-2 break-all text-center text-xs">ssssssssssssssssssssssssssssssssssssssssssssssssssssss</span>
  </div>
  <div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path></svg
    ><span class="line-clamp-2 break-all text-center text-xs">Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum, praesentium.</span>
  </div>
</div>

DEMO on Tailwind Play.

try this code

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full gap-4 grid-cols-8">
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">sssssssssssssss</span>
</div>
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">dummy.mib</span>
</div>
</div></code>
<code><div class="grid w-full gap-4 grid-cols-8"> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">sssssssssssssss</span> </div> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">dummy.mib</span> </div> </div></code>
<div class="grid w-full gap-4 grid-cols-8">
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">sssssssssssssss</span>
  </div>
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">dummy.mib</span>
  </div>
</div>

1

Add the white-space, overflow, and text-overflow properties to the span. it will ensure that the text will be truncated (with an ellipsis) if it overflows its container.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full gap-4 grid-cols-8">
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">sssssssssssssss</span>
</div>
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">dummy.mib</span>
</div>
</div>
</code>
<code><div class="grid w-full gap-4 grid-cols-8"> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">sssssssssssssss</span> </div> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">dummy.mib</span> </div> </div> </code>
<div class="grid w-full gap-4 grid-cols-8">
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">sssssssssssssss</span>
  </div>
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">dummy.mib</span>
  </div>
</div>

1

the easy thing I did was to change the overflow to the top div.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full gap-4 grid-cols-8">
<div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="text-ellipsis text-center text-xs">sssssssssssssssssssssssssssadasd</span>
</div>
<div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg><span class="text-ellipsis text-center text-xs">dummy.mibasdasdasdsad</span></div>
</div>
</code>
<code><div class="grid w-full gap-4 grid-cols-8"> <div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="text-ellipsis text-center text-xs">sssssssssssssssssssssssssssadasd</span> </div> <div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg><span class="text-ellipsis text-center text-xs">dummy.mibasdasdasdsad</span></div> </div> </code>
<div class="grid w-full gap-4 grid-cols-8">
  <div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="text-ellipsis text-center text-xs">sssssssssssssssssssssssssssadasd</span>
  </div>
  <div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg><span class="text-ellipsis text-center text-xs">dummy.mibasdasdasdsad</span></div>
</div>

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Why isn’t the following text being collapsed into a ellipsis?

This is the code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full gap-4 grid-cols-8">
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg><span class="overflow-hidden text-ellipsis text-center text-xs">sssssssssssssss</span></div>
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg><span class="overflow-hidden text-ellipsis text-center text-xs">dummy.mib</span></div>
</div>
</code>
<code><div class="grid w-full gap-4 grid-cols-8"> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg><span class="overflow-hidden text-ellipsis text-center text-xs">sssssssssssssss</span></div> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg><span class="overflow-hidden text-ellipsis text-center text-xs">dummy.mib</span></div> </div> </code>
<div class="grid w-full gap-4 grid-cols-8">
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg><span class="overflow-hidden text-ellipsis text-center text-xs">sssssssssssssss</span></div>
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg><span class="overflow-hidden text-ellipsis text-center text-xs">dummy.mib</span></div>
</div>

The text breaks out of the container instead of being collapsed. Why is that, and how to fix it?

Tailwind Play

The text breaks out of the container

This is because sssssss... is a continuous word and does not force a line break by default. In Tailwind you can use break-all to make text break at any position.

And it seems you intend to implement text overflow ellipsis. In Tailwind you can just use line-clamp-* to achieve this effect directly.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full grid-cols-8 gap-4">
<div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path></svg
><span class="line-clamp-2 break-all text-center text-xs">ssssssssssssssssssssssssssssssssssssssssssssssssssssss</span>
</div>
<div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path></svg
><span class="line-clamp-2 break-all text-center text-xs">Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum, praesentium.</span>
</div>
</div>
</code>
<code><div class="grid w-full grid-cols-8 gap-4"> <div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path></svg ><span class="line-clamp-2 break-all text-center text-xs">ssssssssssssssssssssssssssssssssssssssssssssssssssssss</span> </div> <div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path></svg ><span class="line-clamp-2 break-all text-center text-xs">Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum, praesentium.</span> </div> </div> </code>
<div class="grid w-full grid-cols-8 gap-4">
  <div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path></svg
    ><span class="line-clamp-2 break-all text-center text-xs">ssssssssssssssssssssssssssssssssssssssssssssssssssssss</span>
  </div>
  <div class="max-w-small flex w-full cursor-not-allowed flex-col items-center justify-center gap-1">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path></svg
    ><span class="line-clamp-2 break-all text-center text-xs">Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum, praesentium.</span>
  </div>
</div>

DEMO on Tailwind Play.

try this code

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full gap-4 grid-cols-8">
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">sssssssssssssss</span>
</div>
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">dummy.mib</span>
</div>
</div></code>
<code><div class="grid w-full gap-4 grid-cols-8"> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">sssssssssssssss</span> </div> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">dummy.mib</span> </div> </div></code>
<div class="grid w-full gap-4 grid-cols-8">
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">sssssssssssssss</span>
  </div>
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed" style="width: 100px;">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="overflow-hidden text-ellipsis text-center text-xs" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;">dummy.mib</span>
  </div>
</div>

1

Add the white-space, overflow, and text-overflow properties to the span. it will ensure that the text will be truncated (with an ellipsis) if it overflows its container.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full gap-4 grid-cols-8">
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">sssssssssssssss</span>
</div>
<div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">dummy.mib</span>
</div>
</div>
</code>
<code><div class="grid w-full gap-4 grid-cols-8"> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">sssssssssssssss</span> </div> <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">dummy.mib</span> </div> </div> </code>
<div class="grid w-full gap-4 grid-cols-8">
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">sssssssssssssss</span>
  </div>
  <div class="flex w-full flex-col gap-1 justify-center items-center max-w-small cursor-not-allowed">
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs">dummy.mib</span>
  </div>
</div>

1

the easy thing I did was to change the overflow to the top div.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="grid w-full gap-4 grid-cols-8">
<div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg>
<span class="text-ellipsis text-center text-xs">sssssssssssssssssssssssssssadasd</span>
</div>
<div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
<path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
<path d="M19 7h-4l-.001 -4.001z"></path>
</svg><span class="text-ellipsis text-center text-xs">dummy.mibasdasdasdsad</span></div>
</div>
</code>
<code><div class="grid w-full gap-4 grid-cols-8"> <div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg> <span class="text-ellipsis text-center text-xs">sssssssssssssssssssssssssssadasd</span> </div> <div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10"> <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path> <path d="M19 7h-4l-.001 -4.001z"></path> </svg><span class="text-ellipsis text-center text-xs">dummy.mibasdasdasdsad</span></div> </div> </code>
<div class="grid w-full gap-4 grid-cols-8">
  <div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg>
    <span class="text-ellipsis text-center text-xs">sssssssssssssssssssssssssssadasd</span>
  </div>
  <div class="flex w-full flex-col gap-1 justify-center overflow-hidden items-center max-w-small cursor-not-allowed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none" class="tabler-icon tabler-icon-file-filled h-10 w-10">
      <path d="M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h5z"></path>
      <path d="M19 7h-4l-.001 -4.001z"></path>
    </svg><span class="text-ellipsis text-center text-xs">dummy.mibasdasdasdsad</span></div>
</div>

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật