In an attempt to make a span shrink with an ellipsis when the browser window is made narrow, the following code was used:
body { overflow: hidden; } span { border: solid 2px blue; white-space: nowrap; text-overflow: ellipsis; }
However, this code is not producing the desired effect. To troubleshoot, it's important to ensure the following CSS properties are present:
Here's an example of a corrected code that includes these properties:
span { border: solid 2px blue; white-space: nowrap; text-overflow: ellipsis; width: 100px; display: block; overflow: hidden }
By incorporating these CSS properties, the span should now shrink with ellipsis when the window becomes narrow.
The above is the detailed content of Why Isn't My `text-overflow: ellipsis` Working?. For more information, please follow other related articles on the PHP Chinese website!