'--webkit-line-clamp text overlapping if there are lists element inside the container element on safari browser

I try to implement a line limit for multiline text. Found the line clamp property for this. I also try to add list element inside the container <ol></li></li></ol> This is working fine on chrome browser but on safari browser the text will be overlapped..

.test {
   overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
<div class="test">
   Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
   <ol>
      <li>Hello world</li>
      <li>Hello world</li>
      <li>Hello world</li>
      <li>Hello world</li>
      <li>Hello world</li>
      <li>Hello world</li>
      <li>Hello world</li>
   </ol>
</div>

similar question Safari: -webkit-line-clamp isnt showing ellipsis

been trying to solve this but didn't find the solution.

use safari browser to see the overlapped text result

jsfiddle link: https://jsfiddle.net/u5v0e7k6/1/

providing screenshot here



Solution 1:[1]

I had a similar issue.

Setting display to inline-block on <ol> (or <ul> where an issue also occurs) fixed it for me.

In general, seems to me like Safari doesn't handle well blocks displayed inside of the container with line-clamp setup.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcin Piniarski