Point one style class to another?

前端 未结 10 1380
遇见更好的自我
遇见更好的自我 2021-02-04 23:59

I have a css class like:

.foo {
  background-color: red;
}

then I have a class specified for a list:

.list1 li {
  background-c         


        
10条回答
  •  执念已碎
    2021-02-05 00:35

    You might want to look into a CSS preprocessor such as SASS or LESS. You can define variables that can be used throughout your code. It greatly speeds up your coding when you're familiar with it.

    http://sass-lang.com/

    http://lesscss.org/

    Using SASS:

    $darkred : #841c14;
    .box { 
        background: $darkred;
    }
    

提交回复
热议问题