I have the following code:
.biz-desc {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
max-width: 600px;
}
<div class="section-segment">
<span class="biz-desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent faucibus nisi non tellus pharetra, nec tempus mi fringilla. Vestibulum consequat dolor sit amet orci suscipit, id facilisis metus tempus. Maecenas in massa eget nisl porttitor molestie id ut velit. Nullam quis purus porttitor neque fermentum dignissim quis nec felis. Aenean non maximus quam, sit amet tincidunt sapien. Nam ut gravida libero. Quisque tortor ante, maximus sit amet nunc at, convallis posuere felis. Proin venenatis sit amet metus eu porta.</span>
</div>
My idea is that the description will be truncated and will display three dots (...) when the text is too long for the screen.
This is not working, however. Iām just getting long text that gets out from the div
's border.
I tried to add max-width: 600px;
to .biz-desc
but to no avail.
Can anyone see what is the problem or to tell me how to achieve this modest requirement?