11

I use

  <br />

to insert blank lines on my webpage. What is an elegant way to do the equivalent of 20 - 40 of these? After formatting, each br tag is put on a separate line which make reading the file cumbersome.

RJIGO
  • 1,903
  • 7
  • 22
  • 31

6 Answers6

12

min-height, margin and padding.

You can define CSS styles for that, like

.space { margin-top: 300px; }

And insert it wherever you want to...

<div class="space"></div>

Hope that helps...

devdRew
  • 4,393
  • 3
  • 24
  • 33
4

Old question, but evergreen.

If you really want to use multiple < br > tags, you can do so with

<br />&nbsp;<br />

I find this useful when I want whitespace between paragraphs. Using Div tags to do that is a really bad overkill hack, sorry guys. :-)

Chiwda
  • 1,233
  • 7
  • 30
  • 52
3

That is definitely not the way to have spacing.

Use Css's padding property : http://www.w3schools.com/css/css_padding.asp

Beenish Khan
  • 1,571
  • 10
  • 18
  • why is that "definitely not the way"? – Nick Rolando Apr 20 '12 at 16:18
  • 3
    1) Line breaks are rendered differently by different browsers )2 Not maintainable - Do you really want around 40 line breaks in your code files and counting them to confirm if they are the right number ? )3 CSS properties keep things centralized, so you would have much maintainable code. – Beenish Khan Apr 20 '12 at 16:21
2

use padding between divs or td's instead of <br />

Alex
  • 5,971
  • 11
  • 42
  • 80
1

The question was It would be helpful if someone could explain why using multiple
is not recommended

It's better to use padding or margins on your elements to get the spacing you need. It's more precise (every browser can display the br differently)

margins and padding is more compatible to almost all browsers

skhurams
  • 2,133
  • 7
  • 45
  • 82
0

You can write like this br*100 without angular brackets in VSCode (Emmet Abbreviation) This will insert the required number of blank lines . here 100 blank spaces.

Ravi Kumar
  • 23
  • 3