gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 10:05:13 25 4
gpt4 key购买 nike

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

最佳答案

PX、EM 和百分比有什么区别?

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 的百分比。如果您的 h150px,则 10% padding-top 将是 5px

关于html - 您如何找到以像素为单位的填充百分比?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38065034/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com