| Start |
|---|
Variable Color |
Variable Dimensions |
| Variable Cascading CSS variables cascade in much the same way as other properties, and can be restated safely. You can define variables multiple times and only the definition with the highest specificity will apply to the element selected. Assuming this HTML: We can write this CSS: And get this result: |
| Valid/Invalids Naming When naming CSS variables, it contains only letters and dashes just like other CSS properties (eg: line-height, -moz-box-sizing) but it should start with double dashes (--) CSS Variables are case sensitive. Empty Vs Space Concatenations Careful when using Units |
| With media queries You can re-set variables within media queries and have those new values cascade wherever they are used, something that isn't possible with pre-processor variables. Here, a media query changes the variables used to set up a very simple grid: HTML CSS You can try resizing the window in this CodePen Demo (opens new window) Here's an animated screenshot of the resizing in action: Syntax
RemarksCSS Variables are currently considered an experimental technology. Firefox: Version 31+ (Enabled by default) More info from Mozilla (opens new window) Chrome: Version 49+ (Enabled by default). "This feature can be enabled in Chrome Version 48 for testing by enabling the IE: Not Supported. Edge: Under Development (opens new window) Safari: Version 9.1+ |
Read Article
https://develop.horje.com/learn/1434/reference