Ask Your Question
4

Is it possible for a list of SCSS variables to be inherited?

asked 2023-05-26 20:01:50 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-05-26 20:12:01 +0000

ladyg gravatar image

Yes, SCSS variables can be inherited. When a parent element defines a variable, all of its child elements can use that variable without having to redefine it.

For example, if you define a color variable like this:

$primary-color: #375a7f;

And then you create a button style that uses that variable:

.button { background-color: $primary-color; }

Any child element of .button will also be able to use $primary-color without having to redefine it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-26 20:01:50 +0000

Seen: 24 times

Last updated: May 26 '23