+ 7

Replacements for <br />

I have been told by multiple people that <br /> is bad practice. I've noticed that most codes I make that focus on designing websites use this. Without this tag everything is all squashed up. Is there an alternative for this tag that is good practice? I've been told to use "float" in CSS. I've looked on W3Schools but that method doesn't help me that much.

23rd Jul 2019, 8:23 AM
Clueless Coder
Clueless Coder - avatar
7 ответов
+ 9
Well I have always used <br> because \n doesn't work here in web. It really all boils down to formatting and how you want to do it. Depending on context you might want to approach using other CSS ways.
23rd Jul 2019, 8:48 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
I personally use <br> to break up things inside containers rather than to arrange containers, if that makes sense? For example, the placement of divs is probably better controlled using styling rather than separating them with <br>s.
23rd Jul 2019, 9:41 AM
Rincewind
Rincewind - avatar
+ 3
You can use margin instead but using br tags doesn't harm.
23rd Jul 2019, 9:56 AM
Aykut Saraç
Aykut Saraç - avatar
+ 3
it would be okey to use a div element. this would also make your work more cleaner.
23rd Jul 2019, 4:29 PM
John Laurence Lebarios
John Laurence Lebarios - avatar
+ 3
what is the problem with <br/> ?
24th Jul 2019, 3:30 AM
Reajul Hasan Raju
Reajul Hasan Raju - avatar
+ 3
Yes maybe <div> and other block level elements?
24th Jul 2019, 4:00 AM
Sonic
Sonic - avatar