In normal HTML you would use the br
tag but if I would like to do 20+ newlines it would look very messy. I would like to do this with minimal code.
Asked
Active
Viewed 118 times
0

Shiladitya
- 12,003
- 15
- 25
- 38

Christopher M
- 11
- 3
1 Answers
1
You can do it in a loop with Javascript or your backend language (Php,...).
var text = "";
for (var i = 0; i < 20; i++) {
text += "<br>";
}
document.getElementById("demo").innerHTML = text;
Top
<p id="demo"></p>
Bottom
But if you just need to add some space, you would prefer using CSS padding
or margin
:
div{
margin-bottom: 40px;
}
<div>Top</div>
<div>Bottom</div>

Maarti
- 3,600
- 4
- 17
- 34