Reputation: 3183
Here is what I want to do:
What I did so far can't keep the button showing up. Ellipsis only starts working when the window edge reaches the text.
HTML:
<div class="wrapper">
<span>
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
</span>
<button type="button">Download</button>
</div>
CSS:
.wrapper {
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #b3ffcb;
}
Anyone know how to fix this?
Upvotes: 3
Views: 1910
Reputation: 122047
You can use Flexbox
on wrapper and apply text-overflow: ellipsis
on span
Fiddle
.wrapper {
display: flex;
justify-content: center;
align-items: center;
background-color: #b3ffcb;
}
span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
<div class="wrapper">
<span>foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar </span>
<button type="button">Download</button>
</div>
Upvotes: 4