em is relative to font size of parent. HOWEVER, it is relative to its own element if it is applied to anything else other than font size. Below is example section { font-size: 18px } .abc { font-size: 1.5em; } section { font-size: 18px } .big-abc { font-size: 10px; } .abc { padding: 1em; //here paddingwill be relative to .big-abc and not section tag } <section> <h1 class = "abc big-abc"></h1> </section>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter