您如何找到以像素为单位的填充百分比?

How do you find percentage of a padding that's in pixels?

我一直试图在 Internet 上找到这个问题的答案,但找不到任何解释得很好的东西。我仍然很困惑,不知道如何计算出以像素为单位的填充百分比。例如,我正在查看网站设计,我知道 <h1> 需要在顶部填充 10px,但我如何计算出填充的百分比?

PX、EM和Percent有什么区别?

Pixel is a static measurement, while percent and EM are relative measurements. The size of an EM or percent depends on its parent. If the text size of body is 16 pixels, then 150% or 1.5 EM will be 24 pixels (1.5 * 16). Look at CSS Units for more measurement units.

您问过 h1 顶部的 10px 填充:

您知道以像素为单位的高度是 100%。所以 10% 将是其中的 10%。如果您的 h150px10% padding-top 将是 5px