web analytics

How to make margin-top and margin-bottom work for span tag?

Options

codeling 1595 - 6639
@2015-12-12 10:41:13

Unlike div, p tags which are Block Level elements which can take up margin on all sides, span tag cannot as it's an Inline element which takes up margins horizontally only.

To make margin-top and margin-bottom work for your span element, use display: inline-block; or display: block;.

display: inline-block; as it will be inline as well as block.

display: inline-block; making it block only and it will result your element to render on another line as block level elements.

.forumheading {

     font-size: 10pt;

     font-weight: bold;

     display:inline-block;

     margin-bottom:3px;

}

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com