css做文字限制

如何仅通过CSS实现多行文本超长自动省略号

.ellipsis:after {

    content: "\02026";

    box-sizing: content-box;

    -webkit-box-sizing: content-box;

    -moz-box-sizing: content-box;

    float: right; position: relative;

    top: -22px; left: 100%;

    width: 3em; margin-left: -3em;

    padding-right: 5px;

    text-indent: 24px;

    background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(white), color-stop(50%, white));

    background: -moz-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white);

    background: -o-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white);

    background: -ms-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white);

    background: linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white); }

css做文字限制

你可能感兴趣的:(css做文字限制)