I need to have some text justified in one span-tag and then add "..." in a different span-tag following that text. the "..." should be right after the last letter and not on the next line, i.e. it should be inline - which does not seem to work with justified text! And I can't use anything like jQuery's .append() or anything like that, I'm looking for a pure CSS + HTML solution.
#container {
width: 40%;
margin-left: 25%;
padding: 5%;
}
#container span {
text-align: justify;
display: inline-block;
}
<div id="container">
<span>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. </span>
<span>...</span>
</div>
You can use the following solution using the :after
pseudo-element:
#container {
margin-left:25%;
padding:5%;
width:40%;
}
#container span {
display:inline-block;
text-align:justify;
}
#container span::after {
content:'...';
}
<div id="container">
<span>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</span>
</div>