Css each word new line
You can use the word-spacing
property to add a space between each word, and then use the white-space
property to set the space between words to pre
or nowrap
to make each word appear on a new line.
Here is an example:
<p style="word-spacing: 100px; white-space: pre;">
This is a test
sentence
with multiple
words
</p>
This will add a space of 100 pixels between each word, and then set the space between words to pre
, which will make each word appear on a new line.
Alternatively, you can use the word-break
property to break each word onto a new line:
<p style="word-break: break-all;">
This is a test
sentence
with multiple
words
</p>
This will break each word onto a new line, regardless of the length of the word.
You can also use the display
property and set it to inline-block
and then use the margin
property to add a space between each word:
<p style="display: inline-block; margin: 0 10px;">
This is a test
sentence
with multiple
words
</p>
This will add a space of 10 pixels between each word, and then set the display type to inline-block
, which will make each word appear on a new line.
You can also use the flexbox
layout and set the justify-content
property to space-between
to add a space between each word:
<p style="display: flex; justify-content: space-between;">
This is a test
sentence
with multiple
words
</p>
This will add a space between each word, and then set the display type to flex
, which will make each word appear on a new line.
Please note that the above examples are just a demonstration and you may need to adjust the values and properties to fit your specific use case.