Is there a way to specify "initial" values ​​in css abbreviations, for example, padding?

Say I have a complex style sheet with lots of interacting styles, etc.

For a specific class, I want to override padding-top and padding-bottom without changing the values ​​of padding-left and padding-right (which may be different for different elements that get the class I specify).

Is there a way to do this with a reduction, something like

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

which leaves the previous values, or should I write my css as follows:

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

Thank.

+3
source share
5 answers

No, you cannot use something like "initial", you must use padding-topand padding-bottom.

+3

, , , inherit :

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

.special, .


:

inherit , ( "CSS: The Definitive Guide": values: [|] {1,4} | inherit. @Lekensteyn

, long-hand.

+1

, . .

+1

, , , :

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

Not without using one of the css frameworks that arose as Less: http://lesscss.org/

0
source

Source: https://habr.com/ru/post/1763849/


All Articles