Move an HTML element to a new line [closed]

1 day ago 1
ARTICLE AD BOX

I recently encountered a problem: I need to wrap an HTML element to a new line, but this element has the display: flex property. In normal cases, I know that if I add the flex-wrap: wrap property, the browser will automatically wrap subsequent elements if the line length isn't sufficient. But I have a different case: I need to wrap an HTML element when there's still room on the line, similar to wrapping text in a <p> tag. You can use the <br> tag to wrap text to a new line. How can I separate, for example, 3 texts in this code if I need to save 3 elements as well, rather than combining them into one tag and separating them using the br tag (since I need the ability to assign some CSS properties to them)

<p class="text1">This is text 1!</p> <p class="text2">This is text 2!</p> <p class="text3">This is text 3!</p>

I was wondering if there's a similar way to wrap entire elements while still preserving the HTML elements themselves so I can assign CSS properties to them?

Read Entire Article