Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is using <div> spacers a bad practice? [closed]

Tags:

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; } 
like image 275
Emanuil Rusev Avatar asked Mar 03 '11 16:03

Emanuil Rusev


People also ask

How do you add space between lines in HTML?

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!


1 Answers

It's bad if you could add a margin to content instead. Otherwise, it's the best HTML element for spacers.

like image 198
Aaron Digulla Avatar answered Nov 10 '22 00:11

Aaron Digulla