Styling <BR> to have margins like <P>
I want to style my <BR>
elements to have margins more like <P>
elements. How can 开发者_开发知识库I do that?
Like this:
br {
margin-bottom: 1em;
}
You can use line-height
. You have to have two <br />
, first to break line and second to add range between lines.
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.
Not sure why boogyman's answer has -2, but that's correct. To do what you're asking, try
<p> </p>
That will break the line and still give you the margin.
精彩评论