Should I use Em everywhere or only in Fonts?

5

I know that in should be used instead of px in sources for good application performance on mobile phones, but I only use this in font size. Should I use in also in places like margins, paddings, line-height, etc? Thanks

    
asked by anonymous 05.07.2016 / 14:23

3 answers

3

I agree with @Ricardo Mota on this, I think you'll end up making more calculations than actually making a good website. In my practice for height, width use percentage to facilitate calculations and only use in fonts same, however before using them usually leave them equivalent to 10px, also to facilitate in the calculation. I recommend if you have more doubts about such a practice of using MS visit this article link is in English but it helps a lot. Or that tableless article link . Thanks.

    
06.07.2016 / 17:41
2

in is used in sources to aid responsiveness. If you're going to work with in be prepared to waste time on calculations. Many sites standardize font sizes in pixel like globe and uol.
That tableless matter can help you link

    
05.07.2016 / 15:08
1

What is EM?

1 EM was originally corresponding to the size of the capital letter M of a given source. In CSS, 1 EM corresponds to the font-size value, which, by default, is 16px.

So starting from the general definition of EM, it is ideal for sources. For other measures, such as divs size, etc., turn the pixels into%.

How to do this?

objeto : contexto = resultado.

Example: A 264px column inside a div of 1128px wide.

You get 264 and divide by 1128, which will give 0.23404255319149. Move the comma two to the right and we have the percentage: 23.404255319149%. You can use it without rounding even for greater perfection.

Although this way you can use a lot of calculations, I think the result is much more satisfying if you want a really responsive site.

    
06.07.2016 / 18:26