I am currently working on implementing a multiline breadcrumb link feature for mobile and tablet devices. As users navigate through multiple folders, I need to handle scenarios where the number of links exceeds the maximum allowed in the breadcrumb container. In such cases, I want to prioritize displaying the path from the current location onward. Despite my efforts, I have not been able to find a CSS solution that fits this requirement. Below is an example with max lines = 2
:
current path =
path1 / path2
/ path3 / path4
/path5
In the above scenario, the path exceeds max lines at 'path5' and requires modification as follows:
updated path =
.../ path2
/ path3 / path4
If the user navigates back, the displayed path should update accordingly without ellipses. I've attempted various methods but none have met my expectations:
- An attempt at clamping to max lines using CSS - unsuccessful due to difficulties in determining which links to trim.
- The use of
white-space: no wrap
andtext-overflow: ellipse
was considered, but multiline support remains a challenge. - An exploration into calculating maximum characters per line based on width and font size yielded some results, yet determining the font constant has proven elusive.
I have managed to dynamically adjust width and font size, but the elusive font constant continues to pose a challenge. Any assistance in resolving these issues would be greatly appreciated.