views:

85

answers:

5

I want to style my <BR> elements to have margins more like <P> elements. How can I do that?

+2  A: 

Like this:

br {
    margin-bottom: 1em;
}
SLaks
hasn't any effect in my doc
lovespring
+1  A: 

You can specify any style to almost any element using CSS.

Default margin for P element is 1em 0; So, your CSS code should look like this:

br { 
    margin: 1em 0; 
}

If you need to see default or current style properties for any element, you can use Firefox with Firebug or Chome/Safari/Opera Developer Tools.

Māris Kiseļovs
it doesn't works, even i set the display:block for the br element.
lovespring
A: 

You can use line-height. You have to have two <br />, first to break line and second to add range between lines.

Jeaffrey Gilbert
A: 

Not sure why boogyman's answer has -2, but that's correct. To do what you're asking, try

<p>&nbsp;</p>

That will break the line and still give you the margin.

Adam Tootle
A: 

If you have to use <br> then you can use this:

<br></br> <!-- you MUST have the closing tag -->

And css:

br {
    margin: 1em;
}
box9