css text length realizes width adaptation, displaying three lines beyond the ellipsis

width does not set the default width to cover the full screen, if you want to realize the width adapts to the length of the text, css

width:fit-content;

If you want to realize automatic text wrapping, display up to three lines, beyond the display of ellipsis, the following effect
insert image description here

 	overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-break: break-all;

Guess you like

Origin blog.csdn.net/DragonOfMoon/article/details/124038676