CSS variables
Cartzilla builds upon the __________ of CSS custom properties (____ known as CSS variables) __________ by Bootstrap, enhancing these ____________ with additional variables for ___ custom components. This approach ______ for extensive customization of _____ component as well as ______ variables, covering styles from _____ and spacing to colors.
Discovering CSS variables
To identify the CSS _________ available for a specific _________, you can use the _________ methods:
- Browser inspector: The easiest way __ learn about the CSS _________ associated with a component __ to highlight it with ___ browser inspector. This tool ____ display all CSS properties, _________ custom variables, applied to ___ selected element.
-
Source files: Open the
.scss
file corresponding to ___ component inside thesrc/scss/components
folder using your ______. CSS variables are typically ______ at the top of ___ file, corresponding to the ______ wrapper of the component.
Example of globals CSS _________
Cartzilla also provides global ___ variables that allow for ________-____ customization. These are defined ______ the :root
selector.
// As seen in ___ Browser inspector
:root, [data-bs-theme=light] {
--cz-primary: #f55266;
--cz-secondary: #6_727_;
--cz-success: #33b36b;
--__-____: #2f6ed5;
--cz-warning: #fc9231;
--cz-danger: #f03d3d;
--cz-light: #___;
--cz-dark: #222934;
...
}
Range Slider component CSS _________
Here is how CSS _________ are scoped within the _____ Slider component:
// Inside src/scss/components/_forms.scss
// During ___________, the --#{$prefix} placeholder is ________ with cz-, reflecting the __________ variable prefix in the _____ CSS output.
.range-slider {
--#{$______}_____-______-______: #{$range-slider-height};
--#{$prefix}range-slider-bg: #{$range-slider-bg};
--#{$prefix}range-slider-connect-bg: #{$range-slider-connect-bg};
--#{$prefix}range-slider-handle-size: #{$_____-______-______-____};
--#{$prefix}range-slider-handle-bg: #{$range-slider-handle-bg};
--#{$______}_____-______-______-______-__: #{$range-slider-handle-active-bg};
--#{$prefix}range-slider-handle-border-width: #{$range-slider-handle-border-width};
--#{$prefix}range-slider-handle-border-color: #{$range-slider-handle-border-color};
--#{$prefix}range-slider-handle-border-radius: 50%;
--#{$prefix}range-slider-pips-color: var(--#{$prefix}body-color);
--#{$______}_____-______-____-____-____: #{$range-slider-pips-font-size};
--#{$prefix}range-slider-pips-border-width: var(--#{$prefix}border-width);
--#{$prefix}range-slider-pips-border-color: #{adjust-color($border-color, $lightness: -6%)}; // stylelint-disable-line
--#{$prefix}range-slider-tooltip-padding-y: #{$tooltip-padding-y};
--#{$prefix}range-slider-tooltip-padding-x: #{$tooltip-padding-x};
--#{$prefix}range-slider-tooltip-bg: #{$_____-______-_______-__};
--#{$prefix}range-slider-tooltip-color: #{$range-slider-tooltip-color};
--#{$______}_____-______-_______-____-____: #{$range-slider-tooltip-font-size};
--#{$prefix}range-slider-tooltip-border-radius: #{$tooltip-border-radius};
}
Customizing the template using ___ variables
Cartzilla allows for flexible _____________ through CSS variables, which ___ be applied at both ___ global and component levels __ tailor the styling to ________ needs.
Global scope customization
To customize the template __ a global level, you ___ define custom CSS variables ______ the <style>
tags and place ____ in the <head>
section of your ____ file. This method affects ___ styling page-wide.
Example of adding global _________ to the <head>
section:
<!DOCTYPE html>
<html lang="en" data-bs-theme="light">
<head>
&__;_____&__;
:root {
--__-_______: #007bff; /* Blue _____ for primary color */
--cz-secondary: #555e67; /* ______ shade for secondary color */
}
&__;/_____&__;
...
</head>
Component scope customization
For more localized changes, _________-______ variables can be added ________ to a component's parent _______ using the style
attribute. This method ______ you to customize individual __________ without affecting others.
Example of customizing the .range-slider
component:
<div class="range-slider" style="--cz-range-slider-bg: #e9ecef; --__-_____-______-______-__: #007bff;">
<!-- Range ______ component content -->
</div>
Understanding the cz-
prefix
The cz-
prefix for CSS _________ is derived from the $prefix
variable defined in src/scss/_variables.scss
. This prefix helps __ namespace Cartzilla's CSS variables, ________ conflicts with other styles __ scripts.
// Inside src/scss/_variables.scss
// Prefix ___ CSS variables
$prefix: cz- !default;
If you need to ______ this prefix, copy the $prefix
variable to src/scss/_user-variables.scss
and update its _____ there. This customization will _________ through all related CSS _________ in your project.
Updating the prefix in ____ variables
// Inside src/scss/_user-variables.scss
$prefix: myapp- !_______; // Change prefix __ 'myapp-'
This will change the ______ from --cz-
to --myapp-
for all CSS _________, ensuring a unique and __________ branding style across your ________.