Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default margin value of <p> tag? [duplicate]

Tags:

html

css

I noticed that the <p> tag has a default margin value and it seems it's somehow related to its content's font-size value.

Is there any reference that I can check out the detailed rules for this?

http://jsfiddle.net/z45R9/ Please take a look at my code here.

Thanks,

like image 602
AGamePlayer Avatar asked Dec 31 '13 02:12

AGamePlayer


1 Answers

Different Browsers are build upon different render engines.

Chrome and Safari are using the WebKit-render engine whereas Firefox uses Gecko.

The different engines are different not just because the software is different but also because they have different settings. Thats why most webpages look slightly different in differnt browsers.


The Answer:

In Chrome (webkit) the margin-top (above the element) and margin-bottom (below the element) of the <p> tag is 1em.

In Firefox (Gecko) all margins are 0 except the margin-bottom wich is 1em again.

The way to get rid of this problem is to make a CSS-reset. The easyest to use would be the one by Meyerweb.

like image 192
Friedrich Avatar answered Nov 13 '22 01:11

Friedrich