Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以缩短以下内容,因为请注意值 [6.25% - 5px] 是如何相同的,实际上它应该只定义一次。
margin-top:calc(6.25% - 5px);margin-bottom:calc(6.25% - 5px)
更像是:
margin:calc(6.25% 0 0 - 5px)
但是,导致错误的是 [0 0] 部分,我的观点是在定义边距时 - 您应该始终使用速记;分别定义每个方向。
为了把它放在上下文中,我将它用于页脚:
[边距顶部]
联系信息
[边距底部]
如果要设置上/下和左/右边距,则边距速记属性的语法是:
margin: TB_value LR_value
您似乎正在尝试将其写为:
margin: TB_LR_value_value
不要将0s 放在 TB 值的中间。像往常一样把它们放在后面。无论如何,您只需要一个用于 L 和 R 值。
0
margin: calc(6.25% - 5px) 0;