Is it a bad practice to use <div>
tags to express gaps between elements? If yes - why is it so?
Here's an example:
<div class="panel"> <!-- Content --> </div> <div class="spacer"></div> <div class="panel"> <!-- Content --> </div>
The CSS:
div.spacer { font-size: 0; height: 10px; line-height: 0; }
To create line breaks in HTML, use the <br> tag. There is no closing tag necessary. In the code above, there will be a line break between "125 N 6th St" and "Brooklyn, NY 11249" that won't have the outrageous amount of space that appears between two paragraph elements. It'll just be a nice line break!
It's bad if you could add a margin to content
instead. Otherwise, it's the best HTML element for spacers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With