css - font-size not looking same in pixels and em -
i have webpage made me in have put "frontend developer" text twice on laptop image can compare font-size in pixels , em.
for upper "frontend developer" text, have put font-size: 2.875em
whereas lower "frontend developer" text, have put font-size: 46px
i wondering why font-sizes both of text not looking similar ? although 46px=2.875em (font size)
the css code both of text are:
.frontend-background-image p:nth-child(1) { font-size: 2.875em; color: white; text-align: center; padding-top: 8%; padding-left: 5%; } .frontend-background-image p:nth-child(2) { color: white; text-align: center; padding-left: 5%; font-size: 46px; }
em
relative unit, meaning when ay 2.875em
, mean 2.875 times whatever font size have been start with. 46px 2.875em...if base size 16px. fact other text showing @ different size means base size must else.
when you're inspecting elements in dev tools, can @ 'computed' tab see font size rendering. in case, line coming out @ 40px.
you can change baseline em
relative setting font-size on parent. in case, example, if add:
.frontend-background-image { font-size: 16px; }
it'll make math equal out, , make both of these lines of text same size.
Comments
Post a Comment