1. ホーム
  2. html

[解決済み] How to line-break from css, without using <br />?

2022-03-19 19:50:29

Question

output:

hello
How are you

code:

<p>hello <br> How are you </p>

How to achieve same output without <br> ?

How to solved?

Impossible with the same HTML structure, you must have something to distinguish between Hello and How are you .

I suggest using span s that you will then display as blocks (just like a <div> 実際には)。

p span {
  display: block;
}
<p><span>hello</span><span>How are you</span></p>