Add CSS custom properties to the child theme’s style.css, normally under :root for site-wide tokens or a component selector for local values. Then make sure WordPress actually loads that stylesheet: some parent themes enqueue it automatically, while others require a dependency-aware functions.php enqueue. If the site uses a block theme, inspect theme.json first because it commonly owns global design settings.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
What you are adding, and why the child theme matters
CSS variables are officially called custom properties. Their names begin with two hyphens, such as --brand-color, and another declaration reads the value with var(--brand-color). Because custom properties participate in the CSS cascade and inherit by default, one declaration can control colors, spacing, radii, or typography across many selectors.
As an Amazon Associate I earn from qualifying purchases.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsA child theme is an extension of a parent theme. It gives you a place for custom files and settings that can survive updates to the parent. The variable declarations themselves are ordinary CSS; the WordPress-specific work is making sure the child theme is valid, active, and loaded in the right order.
| Question | Practical answer |
|---|---|
| Where do global variables go? | Put them in :root in the child stylesheet. |
| Where does a component-only variable go? | Put it on the component selector, such as .card, so descendants can inherit it. |
| Can variables replace a CSS property name? | No. var() supplies a value inside a normal declaration; it cannot become a selector or property name. |
| Do you always need PHP? | No. It depends on how the parent theme loads styles. A classic theme may need an explicit enqueue; a block theme may rely primarily on theme.json. |
Identify the theme architecture before editing files
The loading procedure differs between classic and block themes. Check the active theme in Appearance → Themes, then inspect its files before adding PHP or replacing an existing stylesheet workflow.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Classic themes
Classic themes commonly load CSS with wp_enqueue_style(). A parent may enqueue both its own stylesheet and the child stylesheet, only the active stylesheet, or neither automatically. The parent’s functions.php and any documented setup determine which case applies. Do not assume that creating a child directory automatically causes its CSS to appear in the page.
Block themes
Block themes use site editing and frequently express settings and styles through theme.json. WordPress documents that a block theme’s style.css loading is optional and can be unnecessary for many design settings; the documented Twenty Twenty-Four example does not load a stylesheet automatically. Read the existing theme.json and style configuration first. Add a stylesheet only for rules that are not suitably represented there, and verify that the relevant front-end or editor CSS is loaded.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
| Decision | Classic theme | Block theme |
|---|---|---|
| Primary design configuration | PHP enqueue plus CSS files are common. | theme.json often centralizes settings and styles. |
| Child stylesheet assumption | May be loaded by the parent, or may require an enqueue. | style.css loading is optional in many setups. |
| First inspection | Parent functions.php and registered style handles. |
Existing theme.json, style settings, and editor/front-end loading. |
Step 1: create or verify the child theme
Child-theme files live in a directory under wp-content/themes. The directory name is the parent theme’s directory name only by convention; the decisive value is the Template header in the child stylesheet.
- Create or open the child directory under
wp-content/themes. - At the directory root, create
style.css. Do not put the theme header in a nested CSS folder. - Use a header like the following, replacing the template value with the parent directory’s exact name:
/*
Theme Name: My Child Theme
Template: parent-theme-folder
*/
The Template value is case-sensitive in practice: it must match the parent theme folder exactly, not the theme’s display name. Activate the child theme from Appearance → Themes. If it does not appear as an available child theme, check that the file is named style.css, the header is at the top level, and the template directory is correct.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
Step 2: define custom properties with a deliberate scope
Use :root for shared design tokens
Place values needed by unrelated parts of the site on :root. This gives the tokens a document-wide scope while still allowing more specific rules to override them.
:root {
--brand-color: #14532d;
--surface-color: #ffffff;
--text-color: #1f2937;
--content-gap: 1.5rem;
}
Names should describe the role of a value rather than one current use. A semantic name such as --surface-color remains useful if the actual color changes later. Keep the two hyphens, use a consistent naming convention, and remember that custom-property names are case sensitive: --Brand-Color and --brand-color are different names.
Use a component selector for local tokens
A component token belongs on the component when it should not become part of the site-wide API. Descendants inherit it automatically.
.card {
--card-radius: 0.75rem;
border-radius: var(--card-radius);
}
This scope makes overrides predictable. A second card variant can set a different --card-radius without changing every element that uses the global tokens.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
Add a fallback when absence is acceptable
When a token may be undefined or invalid, provide a fallback after a comma:
.button {
background: var(--brand-color, #0f766e);
}
In a browser that supports custom properties, the fallback is used when --brand-color is missing or produces an invalid value for that declaration. It is not a substitute for custom-property support in browsers that do not implement the feature.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Step 3: consume the variables in child-theme rules
Use var() wherever a normal CSS property expects a value. The custom property can supply a complete value or one part of a compound value.
body {
color: var(--text-color);
background: var(--surface-color);
}
.site-header {
border-bottom: 1px solid var(--brand-color);
padding-block: var(--content-gap);
}
The declaration still needs a valid property name, such as color or padding-block. You cannot write var(--property-name): red, and you cannot use var() to generate a selector. If a variable is missing and no fallback is supplied, the browser treats the affected declaration as invalid and the property falls back according to normal CSS rules.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Understand inheritance when overriding
A value on :root is available to descendants unless another rule changes it. A component declaration shadows the inherited value for that component and its descendants. Inspect the element that shows the wrong result, not only the element where you originally declared the token; a nearer declaration, a more specific rule, or an invalid value may be winning the cascade.
Step 4: ensure a classic child stylesheet is loaded
Inspect before adding code
Open the parent theme’s enqueue logic and determine whether it already loads the child stylesheet. WordPress notes that parent themes vary: some load both stylesheets, some load only the active stylesheet, and some load no stylesheet automatically. If the parent already enqueues the child, do not add a second call for the same file.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Enqueue parent and child styles with an explicit dependency
When the parent does not provide the required setup, add an enqueue to the child theme’s functions.php:
<?php
function my_child_enqueue_styles() {
$parent = 'parent-style';
wp_enqueue_style(
$parent,
get_parent_theme_file_uri( 'style.css' )
);
wp_enqueue_style(
'child-style',
get_stylesheet_uri(),
array( $parent ),
wp_get_theme()->get( 'Version' )
);
}
add_action( 'wp_enqueue_scripts', 'my_child_enqueue_styles' );
wp_enqueue_style() is WordPress’s primary stylesheet-enqueue function. The child call lists the parent handle in its dependency array, so WordPress prints the child after the parent. The version argument uses the active child theme’s version metadata and can help browsers fetch a changed file instead of reusing a stale cached copy.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Do not duplicate handles or files
If the parent already registers a handle named differently, use that actual handle in the dependency array rather than inventing a second parent registration. Duplicate handles or duplicate stylesheet files make source inspection and cascade debugging harder. The correct code is specific to the parent’s implementation, so copy its handle and loading assumptions rather than applying a generic snippet blindly.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Step 5: account for block-theme style handling
For a block theme, first locate theme.json and inspect its settings and styles. Global colors, spacing, typography, and other design controls may already be defined there and exposed through the site editor. Adding a parallel set of CSS variables can create two sources of truth.
Keep custom CSS in the child stylesheet when you need selectors or behavior that theme.json cannot express. Then confirm where that CSS is intended to run:
- Front-end rules must be present on the public page.
- Editor-specific rules may need the editor stylesheet path rather than only front-end output.
- Variables used by both contexts must be emitted in both contexts, or components can look correct in one view and unstyled in the other.
Because block themes differ in how they output styles, verify the generated markup and loaded assets instead of assuming that a root style.css is automatically included.
How to verify that the variables work
- Confirm activation. In Appearance → Themes, verify that the child theme is active, not merely installed.
- Check page source or the Network panel. Search for the child stylesheet URL. If it is absent, the problem is loading or theme activation, not the CSS declaration.
- Inspect the computed element. Select an element that should use a token and look for the custom property in computed styles. The browser will show whether it was inherited, overridden, or missing.
- Trace the winning rule. In the Styles panel, identify the declaration that sets the property and any nearer declaration that changes the custom property.
- Test the fallback deliberately. Temporarily remove or rename the token and confirm that a declaration written as
var(--token, fallback)uses its fallback. - Retest after clearing relevant caches. The enqueue version can change the URL’s version query, but a proxy, browser, or optimization layer may still have its own cache.
Troubleshooting common failures
| Symptom | Likely cause | What to check or change |
|---|---|---|
| The child theme is missing from the Themes screen. | Invalid or misplaced header, or an incorrect template directory. | Make sure the root file is named style.css, the header starts at the top, and Template exactly matches the parent folder. |
| The child stylesheet does not appear in source or Network. | The child is inactive, the parent does not load it, or no enqueue was added. | Activate the child, inspect the parent’s enqueue code, and add the explicit classic-theme enqueue only when needed. |
| The parent styles disappeared after adding the child enqueue. | The parent file was never enqueued, or the dependency handle is wrong. | Load the parent first and make the child depend on the exact parent handle. |
| The child CSS loads, but a token has no effect. | Name mismatch, invalid value, or a later declaration overrides it. | Check case and spelling, inspect the custom property in computed styles, and follow the cascade to the winning rule. |
| A component receives the wrong token. | A nearer component declaration or inherited value is shadowing the global token. | Inspect the component and its ancestors; move the token to the intended scope or change the component override. |
| A property silently falls back to an older style. | The referenced token is undefined or invalid for that property. | Define the token in the relevant scope or add a second argument to var() where a fallback is appropriate. |
| Changes are visible in one view but not another. | Front-end and editor styles are being generated or loaded separately. | For a block theme, inspect theme.json and confirm the custom CSS is emitted in every context that needs the token. |
Old colors remain after editing style.css. |
Browser or intermediary caching. | Use the stylesheet version argument, then inspect the requested URL and clear higher-level caches if the old asset is still served. |
Choose the right token scope and loading strategy
| Choice | Use it when | Trade-off |
|---|---|---|
:root |
The value is a shared site token, such as a brand color or content gap. | Easy to reuse globally, but available to every selector and therefore easier to override accidentally. |
| Component selector | The value belongs only to one component family or variant. | Limits unintended reach, but descendants outside that component cannot use it. |
Bare var(--token) |
The token is mandatory and an absent value should expose a configuration error. | No local safety net when the token is undefined or invalid. |
var(--token, fallback) |
A safe default is acceptable if the token is missing. | Prevents a declaration from failing, but can hide a naming or loading mistake if used indiscriminately. |
| Parent-provided child load | The parent already registers and prints the child stylesheet correctly. | No extra PHP, but upgrades or parent changes should be rechecked. |
| Explicit enqueue | The parent does not load the child, or the dependency order is not guaranteed. | More control, but the handle, path, and dependency must match the parent setup. |
A complete small example
The following layout keeps global tokens in one place, gives a card its own radius, and uses a fallback for a button background. Place the CSS in the active child stylesheet after the theme header.
:root {
--brand-color: #14532d;
--surface-color: #ffffff;
--text-color: #1f2937;
--content-gap: 1.5rem;
}
body {
color: var(--text-color);
background: var(--surface-color);
}
.site-header {
border-bottom: 1px solid var(--brand-color);
padding-block: var(--content-gap);
}
.card {
--card-radius: 0.75rem;
border-radius: var(--card-radius);
padding: var(--content-gap);
}
.button {
background: var(--brand-color, #0f766e);
color: var(--surface-color);
}
Here, changing --brand-color updates both the header border and button background. Changing --card-radius affects cards and their descendants only. If the global brand token is unavailable, the button still has the declared fallback in browsers that support custom properties.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Pre-publish checklist
- The child theme is active and its root
style.csshas a validTheme Nameand exactTemplatevalue. - Global tokens are on
:root; component-only tokens are scoped to their component. - Every use has the correct, case-sensitive custom-property name.
- Fallbacks are present where an undefined token should not invalidate a declaration.
- The child stylesheet appears in page source or the Network panel.
- In a classic theme, the parent handle is loaded first and the child depends on it.
- No duplicate parent or child stylesheet enqueue is producing competing copies.
- In a block theme,
theme.jsonhas been checked and front-end/editor output has been verified separately.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




