What is variable and How to create variable in css ?

Custom property defined in css that contain a specific values to be reused throughtout the document. In a large website there is a large amount of css code with a lot of repeated values. The same color can be used 2 or more places or even hundreds of different places. So Custom properties allow us to stored value in one place and reuse on other places.

               
                  element {
                    --main-bg-color: colorname;
                  }
                
               
               
                  :root {
                   --main-bg-color: colorname;
                 }
                
                
               

One thought on “What is variable and How to create variable in css ?

Leave a Reply

Your email address will not be published. Required fields are marked *