I would like to stretch a single word across a div container.
For instance, this word inside a div
should be stretched like this:
The solution I found was to wrap each letter inside a span tag, treat them as flex items, and simply apply justify-content: space-between
:
HTML
<div>
<span>W</span><span>O</span><span>R</span><span>D</span>
</div>
CSS
div {
font-size: 32px;
width: 50%;
background-color: #89CFF0;
padding: 1rem;
display: flex;
justify-content: space-between;
}
This works, however, I would not like to wrap each letter inside tags.
Question: Is there a way to stretch a word across a container without wrapping each letter in tags and without use of jQuery? Furthermore, wrapping the letters inside tags using JS is also an option I would like to avoid, because it is essentially the same as the solution above.
For instance, just having a word inside a div like this to be stretched across the width of the container
<div>
WORD
</div>
I would like to know if there is a way to solve this issue with CSS or/and vanilla JS only.