Skip to main content
100%

CSS 将显示不完的多余字符用省略号代替兼容各主要浏览器 IE6+、FF、Chrom

✓ Published0🌍 Public
LLaughingVzr
Last edited Feb 18, 2014
Created on May 18, 2016

This example demonstrates CSS techniques for truncating overflowing text with ellipses in both single-line and multi-line layouts. The single-line method applies the `text-overflow: ellipsis` property alongside vendor-prefixed versions (`-o-text-overflow`, `-moz-text-overflow`, `-webkit-text-overflow`) and requires `white-space: nowrap` and `overflow: hidden`. For multi-line text, the approach simulates ellipsis by positioning a child `<div>` containing "..." absolutely at the bottom-right corner over a relative-positioned container with `overflow: hidden`. The code uses only standard HTML and CSS, with no external libraries or data sources.

AI-generated description

Similar vizzes