If we want to start a new line, which tag is used in HTML?

Do not use <br>. Repeat: do not use <br>.

HTML is about content.

<br> is an HTML element but it is about the presentation of a break (visually a line break – not sure about aurally).

MDN sees the use of <br> in poems and addresses wherein the division of lines is important.

Mozilla Foundation<br>
1981 Landings Drive<br>
Building K<br>
Mountain View, CA 94043-0801<br>
USA

But why not use:

<div>Mozilla Foundation</div>
<div>1981 Landings Drive</div>
<div>Building K</div>
<div>Mountain View, CA 94043-0801</div>
<div>USA</div>

Or even:

<div class="foundation-name">Mozilla Foundation</div>
<div class="street-name">1981 Landings Drive</div>
<div class="building-name">Building K</div>
<div class="state-zip-name">Mountain View, CA 94043-0801</div>
<div class="country-name">USA</div>

Or even use Microformats.

But not <br>!

You could always start a new line as long as you markup the content in a block-level element like <div>.

The best part of this is that you could add a class attribute that you could name semantically (about what kind of content it is) and style it using CSS.


Originally published in Quora


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *