I am attempting to design tabs that can dynamically resize similar to how Chrome tabs behave. However, I am uncertain if achieving this functionality is possible without relying on JavaScript.
Browser compatibility is not a concern for me; my main goal is to determine if it can be accomplished using only HTML and CSS/CSS3.
Here are the requirements:
- The tabs should never expand wider than the text they contain
- When the rightmost tab reaches the edge of the window during resizing, the tabs should begin to shrink (ideally starting with the widest tab)
- The active tab must maintain its size and not shrink
- As the tabs decrease in width, the text should be truncated with an ellipsis
- The tabs should stop shrinking once they reach a minimum width that I specify (preventing them from disappearing entirely)
Is it feasible to achieve this using properties like display: box; and box-flex: 1;? I have been unable to implement it successfully thus far. While I have managed to accomplish this with JavaScript, the performance isn't as optimal as desired for our large web application.
So, any CSS experts out there willing to take on the challenge? If there's a way to achieve this with minimal reliance on JavaScript, I am also open to exploring those options.
Thank you everyone!