Relationship of EM PX

Source: Internet
Author: User

In this case, the two commonly used units in CSS that define the font size are em and PX.

Em is a relative logarithm. For example, 1.1em represents the width of 1.1 characters, and the width of this character is initialized Based on font-size. At the same time, EM also inherits the features of the parent object, so 1.2em in different locations is not necessarily equal, but this articleArticleIt does not matter.
Px indicates the resolution of the current display device. Although the size difference still exists between different devices, it is more suitable for defining fonts.
This template does not specifically define the font size of the search part, so it uses the font-size parameter 12px of the parent object. The font size defined by Internet Explorer is different from that defined by FF/opera. By default, 1 em looks bigger in IE than other browsers, therefore, you must add the following definitions to the body:CopyCodeCode: font-size: 62.5%;
Font-family: 'lucida grande', verdana, Arial, sans-serif;

The key is the first sentence, which makes the font size of IE look like 1em = 10px, which is similar to FF/opera.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.