7

I'm writing some code and want to have some space between two inputs and <br /> is not working in Firefox:

<input type="text" id="X_Axis" /><br />
<input type="text" id="Y_Axis" />

None of <br /> , <br/>, </br> work.

P.S. I haven't tried it in any other browser, so it might not be Firefox, as I suppose.

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
Zippie
  • 6,018
  • 6
  • 31
  • 46
  • 1
    Just use `
    `. See here: http://stackoverflow.com/questions/1946426/html-5-is-it-br-br-or-br
    – Jonathan M May 08 '12 at 14:27
  • 1
    tag inserts a line break not space. – Okan Kocyigit May 08 '12 at 14:27
  • 1
    Please post the code relevant to the question. As in, the complete markup of the relevant part. Ideally, **in addition** to the code in the question body itself, please add a [jsFiddle](http://jsfiddle.net/api/post/jquery/1.7.1/) example of your problem. It will help us help you. – Madara's Ghost May 08 '12 at 14:27
  • 2
    What do you mean by "not working"? What happens and what do you expect to happen? You have to be precise, otherwise we cannot give proper answers. – Felix Kling May 08 '12 at 14:28
  • what are you saying ? It works 100% . What is the version ? and paste some of the html . there is some problem there . Do you want to insert a line break or space in between ? – CyprUS May 08 '12 at 14:28
  • 3
    Mozilla is an ancient browser (though not as old as Netscape). Did you mean Firefox? – BoltClock May 08 '12 at 14:30
  • The tag `
    ` is valid in HTML-Doctypes, whereas xHTML-Tags always have to be closed where `
    ` is correct.
    – Benedikt Wölk May 08 '12 at 14:31
  • or two
    s will not work on Firefox.
    – Aaron Liu Jun 30 '16 at 21:05

2 Answers2

15

Using <br/> to add spacing between HTML elements is bad practice. I suggest assigning CSS padding or margins to your form elements. The following post is very informative: When to use <br> line breaks vs CSS positioning?

Working example: http://jsfiddle.net/uHKzq/1/

I have added the CSS property display: block; which will cause your second form element to display on the line below the first. I have then applied a margin around the form element, which creates a space between your two form input fields.

matdev
  • 4,115
  • 6
  • 35
  • 56
Jack
  • 15,614
  • 19
  • 67
  • 92
4

This is great. I have 2 adsense link units and I wanted to place a break line.

<br> didn't work so I did like you suggested only in my widget area with div elements in between two ad unit placeholders


First adsense code

<div style="margin: 10px 0 10px 0;"></div>

Second adsense code

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
IvanS
  • 59
  • 4