Home >Web Front-end >CSS Tutorial >em px relationship_experience exchange
The situation is like this. There are two commonly used units for defining font size in CSS: em and px.
em is a relative number. For example, 1.1em means 1.1 character width, and this character width is initialized based on font-size. At the same time, em also inherits the characteristics of the parent object, so 1.2em at different positions are not necessarily equal, but this article has nothing to do with this and I won’t go into details.
px is for the resolution of the current display device. Although there will still be size differences for different devices, it is relatively more suitable for defining fonts.
I did not specifically define the font size of the search part in this template, so it used the font-size parameter 12px of the parent object. The damn IE definition of font size is actually different from FF/Opera. By default, 1em looks larger in IE than other browsers, so you need to add the following definition to the body part: