Ive got a word cloud kind of design that im looking to code, but struggling on how to get it working how id like.
Word 1 • Word 2 • Word 3 • Word 4
Word 5 • Word 6 • Word 7
Word 8 • Word 9 • Word 10 • Word 11
You see how the dot only appears after an item when its not last in line.
This will be dynamic, I will not know how many words are on a line, this will depend on the length of the words.
.word-cloud {
width: 400px;
display:flex;
flex-wrap: wrap;
gap: 16px;
}
.word-cloud span {
display:flex;
gap: 16px;
}
.word-cloud span:not(:last-child)::after {
content: "·";
display: block;
}
<div class="word-cloud">
<span>Word 1</span>
<span>Word 2</span>
<span>Word 3</span>
<span>Word 4</span>
<span>Word 5</span>
<span>Word 6</span>
<span>Word 7</span>
<span>Word 8</span>
<span>Word 9</span>
<span>Word 10</span>
<span>Word 11</span>
</div>
This is what I currently have, but cant figure out a way to hide the dot after the last item of each line.