Friday, July 8, 2016

CSS em

A single em unit is equivalent to an element’s font size. So, for example, if an element has a font size of 14 pixels and a width set to 5em, the width would equal 70 pixels (14 pixels multiplied by 5).
1
2
3
4
5
.banner {
  font-size: 14px;
  width: 5em;
}
When a font size is not explicitly stated for an element, the em unit will be relative to the font size of the closest parent element with a stated font size.

No comments:

Post a Comment