CSS简写中的通配符?
我目前在某些东西上有 margin-top:25px
,并且我想使用以下简写更改其他 3 个属性:
/*Shorthand: <top> <right+left> <bottom>*/
margin: * 10px 50px;
我应该用什么替换 * 才能将其保留在 25px 上? (并且不要说25px,因为有时我不知道之前的margin-top值!)
有没有办法做到这一点?或者我必须使用:
margin-right:10px;
margin-bottom:50px;
margin-left:10px;
但我真的想使用简写 >_<
I currently have margin-top:25px
on something, and I want to change the other 3 attributes using this shorthand:
/*Shorthand: <top> <right+left> <bottom>*/
margin: * 10px 50px;
What should I replace the * for in order to leave it on 25px? (and don't say 25px, because sometimes I won't know the previous margin-top value!)
Is there a way to do this? Or I must use:
margin-right:10px;
margin-bottom:50px;
margin-left:10px;
But I really want to use the shorthand >_<
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许我误解了这个问题,但是您是否想继承顶部边距的价值,这就是为什么您并不总是知道该价值?如果是这种情况,您可以尝试:
Maybe I'm misunderstanding the question, but are you wanting to inherit the value of the top-margin, and that's why you don't always know the value? If that's the case, you might try: