Here is the pretty short fiddle which includes a 20px by 20px “ruler”. I expect my p tag to be 20px high…10px text, and 10 px for the top and bottom padding (5px + 5px).
However it looks to be about 22px.
I have reset the body tag, the p tag and the div tag using margin 0px, padding 0px and line-height 100%.
Previously I had as a similar issue that was fixed by setting line-height to 100%….however this is not working here?
I want to know the exact cause – CSS attribute and value.
But for testing purposes I clicked the normalize box in jsfiddle and this had no effect either.
Added in more resets here:
I created a small test case, but it worked fine there. So, I went back to your answer, and found you were setting
p‘sdisplayvalue toinline, which was causing the 2px – 3px difference (fixed version). To fix, change your CSS as follows (look at comments):