是否有一种方法来指定“初始”值在css shorthands如padding? [英] Is there a way to specify "initial" values in css shorthands like padding?

查看:113
本文介绍了是否有一种方法来指定“初始”值在css shorthands如padding?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个包含大量互动样式的复杂样式表。

Say I have a complex stylesheet with lots of interacting styles etc.

对于特定类,我想覆盖padding-top和padding-左边和右边padding的值(对于获取我指定的类的不同元素,它们可能是不同的东西)。

For a specific class, I want to override padding-top and padding-bottom, without changing the values of padding-left and padding-right (which might even be different things for different elements that get the class I'm specifying).

有办法使用缩写,像

.special {
    padding: 10px initial 5px;
}

离开以前的值,或者我必须拼写出我的CSS这:

that leaves the previous values, or do I have to spell out my css like this:

.special {
    padding-top: 10px;
    padding-bottom: 5px;
}

感谢。

推荐答案

不能使用像'initial'这样的东西,你应该使用 padding-top padding -bottom

No you can't use something like 'initial', you should use padding-top and padding-bottom.

这篇关于是否有一种方法来指定“初始”值在css shorthands如padding?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆