Is it out of date to use
tag nowadays? If so, what should I use instead?
For new line, I coding like this. This is not supposed to do these days?
<br />
<br />
<br />
<br />
<br />
is meant to be used as to represent a break in said content, a common example would be an address:
<p>
20 street name<br />
City Name<br />
etc.
</p>
As you can see in the above example, the address is all one group of content, the breaks are only for presentational purposes.
In short: <p>
tags should be used to seperate content into blocks, and the <br />
tag should be used for any breaks needed in that content (for presentational purposes, as in the example above)
The <br />
tag is perfectly valid, it's in the current HTML5 spec too.
HTML 5 only requires <br>
however <br/>
is still fine.
If you were using something like XHTML you would want that to be <br />
anyway..
This question will probably tell you everything you need to know: HTML 5: Is it <br>, <br/>, or <br />?
(From the original question, before it was edited): The "line break end tag" should only ever have been used in XHTML served with an XML content-type (i.e. almost never) and even then you could still use <br />
.
Dealing with the edited question alone:
If you want a line break then use <br>
(or <br />
in XHTML). HTML 5 also permits <br />
but this is just syntactic sugar for the XML addicted and bad syntax highlighters.
The line break element isn't out of date, but like any other element, it should only be used in appropriate places. There aren't many places when a line break is appropriate, the most common ones that prince to mind are postal addresses and poetry. In most cases a <p>
is more suitable. In places where multiple sequential line breaks appear, a stylesheet that adds padding or margins is often the right choice.
I'm going to answer the question differently:
You can use <br />
but to answer the question the way I think you are asking... is that you can have the <p>
or <div>
control the spacing using padding element. so instead of adding <br />
just make padding on the p or div element. But as people mention <p>
is the way to go :)
` according to W3C. – Stéphane Bruckert Jan 07 '13 at 14:15
, or
in plain HTML. – Chris Jan 07 '13 at 14:17
?](https://stackoverflow.com/q/17494029/578288) – Rory O'Kane Feb 02 '18 at 23:22