{"id":5855,"date":"2026-02-12T20:45:35","date_gmt":"2026-02-13T01:45:35","guid":{"rendered":"https:\/\/chubes.net\/?documentation=css-generation"},"modified":"2026-03-13T03:29:36","modified_gmt":"2026-03-13T07:29:36","slug":"css-generation","status":"publish","type":"documentation","link":"https:\/\/chubes.net\/docs\/wordpress-core\/theme-json\/css-generation\/","title":{"rendered":"CSS Generation"},"content":{"rendered":"<p>How WordPress generates CSS from theme.json configurations.<\/p><h2 class=\"wp-block-heading\">Overview<\/h2><p>WordPress processes theme.json and generates:<\/p><ol class=\"wp-block-list\"><li><strong>CSS Custom Properties<\/strong> (variables) from settings<\/li><li><strong>Utility Classes<\/strong> for presets<\/li><li><strong>Global Styles<\/strong> from styles configuration<\/li><li><strong>Block Styles<\/strong> for per-block configurations<\/li><\/ol><h2 class=\"wp-block-heading\">CSS Custom Properties<\/h2><h3 class=\"wp-block-heading\">Property Naming Convention<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\"><\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code\"><code>--wp--preset--{category}--{slug}\n--wp--custom--{path}\n--wp--style--{property}<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Settings \u2192 CSS Variables<\/h3><figure class=\"wp-block-table\"><table><thead><tr><th>Setting<\/th><th>CSS Variable Pattern<\/th><\/tr><\/thead><tbody><tr><td><code>color.palette<\/code><\/td><td><code>--wp--preset--color--{slug}<\/code><\/td><\/tr><tr><td><code>color.gradients<\/code><\/td><td><code>--wp--preset--gradient--{slug}<\/code><\/td><\/tr><tr><td><code>typography.fontFamilies<\/code><\/td><td><code>--wp--preset--font-family--{slug}<\/code><\/td><\/tr><tr><td><code>typography.fontSizes<\/code><\/td><td><code>--wp--preset--font-size--{slug}<\/code><\/td><\/tr><tr><td><code>spacing.spacingSizes<\/code><\/td><td><code>--wp--preset--spacing--{slug}<\/code><\/td><\/tr><tr><td><code>shadow.presets<\/code><\/td><td><code>--wp--preset--shadow--{slug}<\/code><\/td><\/tr><tr><td><code>custom.*<\/code><\/td><td><code>--wp--custom--{path-kebab-case}<\/code><\/td><\/tr><\/tbody><\/table><\/figure><h3 class=\"wp-block-heading\">Example Generation<\/h3><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;settings&quot;: {\n    &quot;color&quot;: {\n      &quot;palette&quot;: [\n        { &quot;slug&quot;: &quot;primary&quot;, &quot;color&quot;: &quot;#0066cc&quot;, &quot;name&quot;: &quot;Primary&quot; },\n        { &quot;slug&quot;: &quot;secondary&quot;, &quot;color&quot;: &quot;#ff6600&quot;, &quot;name&quot;: &quot;Secondary&quot; }\n      ]\n    },\n    &quot;typography&quot;: {\n      &quot;fontFamilies&quot;: [\n        { &quot;slug&quot;: &quot;body&quot;, &quot;fontFamily&quot;: &quot;Inter, sans-serif&quot;, &quot;name&quot;: &quot;Body&quot; }\n      ],\n      &quot;fontSizes&quot;: [\n        { &quot;slug&quot;: &quot;small&quot;, &quot;size&quot;: &quot;0.875rem&quot;, &quot;name&quot;: &quot;Small&quot; },\n        { &quot;slug&quot;: &quot;medium&quot;, &quot;size&quot;: &quot;1rem&quot;, &quot;name&quot;: &quot;Medium&quot; }\n      ]\n    },\n    &quot;spacing&quot;: {\n      &quot;spacingSizes&quot;: [\n        { &quot;slug&quot;: &quot;10&quot;, &quot;size&quot;: &quot;0.5rem&quot;, &quot;name&quot;: &quot;XS&quot; },\n        { &quot;slug&quot;: &quot;20&quot;, &quot;size&quot;: &quot;1rem&quot;, &quot;name&quot;: &quot;S&quot; }\n      ]\n    },\n    &quot;custom&quot;: {\n      &quot;lineHeight&quot;: {\n        &quot;body&quot;: 1.6,\n        &quot;heading&quot;: 1.2\n      }\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated CSS:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">body {\n  --wp--preset--color--primary: #0066cc;\n  --wp--preset--color--secondary: #ff6600;\n  --wp--preset--font-family--body: Inter, sans-serif;\n  --wp--preset--font-size--small: 0.875rem;\n  --wp--preset--font-size--medium: 1rem;\n  --wp--preset--spacing--10: 0.5rem;\n  --wp--preset--spacing--20: 1rem;\n  --wp--custom--line-height--body: 1.6;\n  --wp--custom--line-height--heading: 1.2;\n}<\/code><\/pre><\/div><h2 class=\"wp-block-heading\">Utility Classes<\/h2><p>WordPress generates utility classes for presets:<\/p><h3 class=\"wp-block-heading\">Color Classes<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">\/* Background colors *\/\n.has-primary-background-color {\n  background-color: var(--wp--preset--color--primary) !important;\n}\n.has-secondary-background-color {\n  background-color: var(--wp--preset--color--secondary) !important;\n}\n\n\/* Text colors *\/\n.has-primary-color {\n  color: var(--wp--preset--color--primary) !important;\n}\n.has-secondary-color {\n  color: var(--wp--preset--color--secondary) !important;\n}\n\n\/* Border colors *\/\n.has-primary-border-color {\n  border-color: var(--wp--preset--color--primary) !important;\n}<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Gradient Classes<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">.has-primary-to-secondary-gradient-background {\n  background: var(--wp--preset--gradient--primary-to-secondary) !important;\n}<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Font Size Classes<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">.has-small-font-size {\n  font-size: var(--wp--preset--font-size--small) !important;\n}\n.has-medium-font-size {\n  font-size: var(--wp--preset--font-size--medium) !important;\n}<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Font Family Classes<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">.has-body-font-family {\n  font-family: var(--wp--preset--font-family--body) !important;\n}<\/code><\/pre><\/div><h2 class=\"wp-block-heading\">Global Styles<\/h2><p>Styles from the <code>styles<\/code> section generate CSS rules:<\/p><h3 class=\"wp-block-heading\">Root Styles<\/h3><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;styles&quot;: {\n    &quot;color&quot;: {\n      &quot;background&quot;: &quot;#ffffff&quot;,\n      &quot;text&quot;: &quot;#1a1a1a&quot;\n    },\n    &quot;typography&quot;: {\n      &quot;fontFamily&quot;: &quot;var(--wp--preset--font-family--body)&quot;,\n      &quot;fontSize&quot;: &quot;var(--wp--preset--font-size--medium)&quot;,\n      &quot;lineHeight&quot;: &quot;1.6&quot;\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated CSS:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">body {\n  background-color: #ffffff;\n  color: #1a1a1a;\n  font-family: var(--wp--preset--font-family--body);\n  font-size: var(--wp--preset--font-size--medium);\n  line-height: 1.6;\n}<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Element Styles<\/h3><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;styles&quot;: {\n    &quot;elements&quot;: {\n      &quot;link&quot;: {\n        &quot;color&quot;: { &quot;text&quot;: &quot;#0066cc&quot; },\n        &quot;:hover&quot;: { &quot;color&quot;: { &quot;text&quot;: &quot;#004499&quot; } }\n      },\n      &quot;h1&quot;: {\n        &quot;typography&quot;: { &quot;fontSize&quot;: &quot;2.5rem&quot; }\n      }\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated CSS:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">a {\n  color: #0066cc;\n}\na:hover {\n  color: #004499;\n}\nh1 {\n  font-size: 2.5rem;\n}<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Block Styles<\/h3><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;styles&quot;: {\n    &quot;blocks&quot;: {\n      &quot;core\/paragraph&quot;: {\n        &quot;typography&quot;: { &quot;lineHeight&quot;: &quot;1.75&quot; }\n      },\n      &quot;core\/button&quot;: {\n        &quot;border&quot;: { &quot;radius&quot;: &quot;0.5rem&quot; }\n      }\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated CSS:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">.wp-block-paragraph {\n  line-height: 1.75;\n}\n.wp-block-button .wp-block-button__link {\n  border-radius: 0.5rem;\n}<\/code><\/pre><\/div><h2 class=\"wp-block-heading\">Layout CSS<\/h2><h3 class=\"wp-block-heading\">Content Width<\/h3><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;settings&quot;: {\n    &quot;layout&quot;: {\n      &quot;contentSize&quot;: &quot;720px&quot;,\n      &quot;wideSize&quot;: &quot;1200px&quot;\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated CSS:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">body {\n  --wp--style--global--content-size: 720px;\n  --wp--style--global--wide-size: 1200px;\n}\n\n.is-layout-constrained &gt; :where(:not(.alignleft):not(.alignright):not(.alignfull)) {\n  max-width: var(--wp--style--global--content-size);\n  margin-left: auto !important;\n  margin-right: auto !important;\n}\n\n.is-layout-constrained &gt; .alignwide {\n  max-width: var(--wp--style--global--wide-size);\n}\n\n.is-layout-constrained &gt; .alignfull {\n  max-width: none;\n}<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Block Gap<\/h3><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;styles&quot;: {\n    &quot;spacing&quot;: {\n      &quot;blockGap&quot;: &quot;2rem&quot;\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated CSS:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">body {\n  --wp--style--block-gap: 2rem;\n}\n\n.is-layout-flow &gt; * + * {\n  margin-block-start: var(--wp--style--block-gap);\n}\n\n.is-layout-flex {\n  gap: var(--wp--style--block-gap);\n}\n\n.is-layout-grid {\n  gap: var(--wp--style--block-gap);\n}<\/code><\/pre><\/div><h2 class=\"wp-block-heading\">@font-face Generation<\/h2><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;settings&quot;: {\n    &quot;typography&quot;: {\n      &quot;fontFamilies&quot;: [\n        {\n          &quot;slug&quot;: &quot;inter&quot;,\n          &quot;name&quot;: &quot;Inter&quot;,\n          &quot;fontFamily&quot;: &quot;&#039;Inter&#039;, sans-serif&quot;,\n          &quot;fontFace&quot;: [\n            {\n              &quot;fontFamily&quot;: &quot;Inter&quot;,\n              &quot;fontWeight&quot;: &quot;400&quot;,\n              &quot;fontStyle&quot;: &quot;normal&quot;,\n              &quot;fontDisplay&quot;: &quot;swap&quot;,\n              &quot;src&quot;: [&quot;file:.\/assets\/fonts\/inter-regular.woff2&quot;]\n            },\n            {\n              &quot;fontFamily&quot;: &quot;Inter&quot;,\n              &quot;fontWeight&quot;: &quot;700&quot;,\n              &quot;fontStyle&quot;: &quot;normal&quot;,\n              &quot;fontDisplay&quot;: &quot;swap&quot;,\n              &quot;src&quot;: [&quot;file:.\/assets\/fonts\/inter-bold.woff2&quot;]\n            }\n          ]\n        }\n      ]\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated CSS:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">@font-face {\n  font-family: &#039;Inter&#039;;\n  font-weight: 400;\n  font-style: normal;\n  font-display: swap;\n  src: url(&#039;\/wp-content\/themes\/theme-slug\/assets\/fonts\/inter-regular.woff2&#039;) format(&#039;woff2&#039;);\n}\n\n@font-face {\n  font-family: &#039;Inter&#039;;\n  font-weight: 700;\n  font-style: normal;\n  font-display: swap;\n  src: url(&#039;\/wp-content\/themes\/theme-slug\/assets\/fonts\/inter-bold.woff2&#039;) format(&#039;woff2&#039;);\n}\n\nbody {\n  --wp--preset--font-family--inter: &#039;Inter&#039;, sans-serif;\n}<\/code><\/pre><\/div><h2 class=\"wp-block-heading\">Duotone Filters<\/h2><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;settings&quot;: {\n    &quot;color&quot;: {\n      &quot;duotone&quot;: [\n        {\n          &quot;slug&quot;: &quot;blue-orange&quot;,\n          &quot;colors&quot;: [&quot;#0066cc&quot;, &quot;#ff6600&quot;],\n          &quot;name&quot;: &quot;Blue and Orange&quot;\n        }\n      ]\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated Output:<\/strong><\/p><p>WordPress injects an SVG filter definition and CSS:<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">html<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-html\"><code class=\"language-html\">&lt;svg xmlns=&quot;http:\/\/www.w3.org\/2000\/svg&quot; viewBox=&quot;0 0 0 0&quot; style=&quot;position: fixed;&quot;&gt;\n  &lt;filter id=&quot;wp-duotone-blue-orange&quot;&gt;\n    &lt;feColorMatrix type=&quot;matrix&quot; values=&quot;...&quot;\/&gt;\n    &lt;feComponentTransfer color-interpolation-filters=&quot;sRGB&quot;&gt;\n      &lt;feFuncR type=&quot;table&quot; tableValues=&quot;0 1&quot;\/&gt;\n      &lt;feFuncG type=&quot;table&quot; tableValues=&quot;0.4 0.6&quot;\/&gt;\n      &lt;feFuncB type=&quot;table&quot; tableValues=&quot;0.8 0.4&quot;\/&gt;\n    &lt;\/feComponentTransfer&gt;\n  &lt;\/filter&gt;\n&lt;\/svg&gt;<\/code><\/pre><\/div><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">.wp-duotone-blue-orange img,\n.wp-duotone-blue-orange .wp-block-cover__image-background {\n  filter: url(#wp-duotone-blue-orange);\n}<\/code><\/pre><\/div><h2 class=\"wp-block-heading\">CSS Output Location<\/h2><h3 class=\"wp-block-heading\">Frontend<\/h3><p>CSS is output in <code>&lt;head&gt;<\/code> via <code>wp_head<\/code>:<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">html<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-html\"><code class=\"language-html\">&lt;style id=&quot;global-styles-inline-css&quot;&gt;\n  \/* CSS Custom Properties *\/\n  body { --wp--preset--color--primary: #0066cc; ... }\n  \n  \/* Global styles *\/\n  body { background-color: #fff; ... }\n  \n  \/* Element styles *\/\n  a { color: #0066cc; }\n  \n  \/* Block styles *\/\n  .wp-block-paragraph { ... }\n  \n  \/* Utility classes *\/\n  .has-primary-color { color: var(--wp--preset--color--primary) !important; }\n&lt;\/style&gt;<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Editor<\/h3><p>Similar CSS is injected into the block editor iframe.<\/p><h2 class=\"wp-block-heading\">Specificity<\/h2><p>WordPress uses specific selectors to balance cascade:<\/p><figure class=\"wp-block-table\"><table><thead><tr><th>Context<\/th><th>Selector Pattern<\/th><th>Specificity<\/th><\/tr><\/thead><tbody><tr><td>Root styles<\/td><td><code>body<\/code><\/td><td>0,0,1,1<\/td><\/tr><tr><td>Elements<\/td><td><code>a<\/code>, <code>h1<\/code>, etc.<\/td><td>0,0,0,1<\/td><\/tr><tr><td>Blocks<\/td><td><code>.wp-block-{name}<\/code><\/td><td>0,0,1,0<\/td><\/tr><tr><td>Utility classes<\/td><td><code>.has-{preset}-{property}<\/code><\/td><td>0,0,1,0 + <code>!important<\/code><\/td><\/tr><tr><td>User styles<\/td><td>Various<\/td><td>Depends<\/td><\/tr><\/tbody><\/table><\/figure><p>The <code>!important<\/code> on utility classes ensures they override other styles when applied.<\/p><h2 class=\"wp-block-heading\">Custom CSS Property<\/h2><p>Add arbitrary CSS via the <code>css<\/code> property:<\/p><p><strong>theme.json:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{\n  &quot;styles&quot;: {\n    &quot;css&quot;: &quot;scroll-behavior: smooth;&quot;,\n    &quot;blocks&quot;: {\n      &quot;core\/button&quot;: {\n        &quot;css&quot;: &quot;&amp; .wp-block-button__link { transition: all 0.2s ease; }&quot;\n      }\n    }\n  }\n}<\/code><\/pre><\/div><p><strong>Generated CSS:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">css<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-css\"><code class=\"language-css\">body {\n  scroll-behavior: smooth;\n}\n\n.wp-block-button .wp-block-button__link {\n  transition: all 0.2s ease;\n}<\/code><\/pre><\/div><p>The <code>&amp;<\/code> in block CSS references the block&#8217;s root selector.<\/p><h2 class=\"wp-block-heading\">Accessing Generated CSS<\/h2><h3 class=\"wp-block-heading\">PHP<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">\/\/ Get all generated CSS\n$css = wp_get_global_stylesheet();\n\n\/\/ Get CSS for specific context\n$css = wp_get_global_stylesheet( array( &#039;variables&#039;, &#039;presets&#039;, &#039;styles&#039; ) );<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Inspecting Output<\/h3><p>View generated CSS:<\/p><ol class=\"wp-block-list\"><li>Open browser DevTools<\/li><li>Find <code>&lt;style id=&quot;global-styles-inline-css&quot;&gt;<\/code><\/li><li>Or check <code>&lt;style id=&quot;wp-block-library-inline-css&quot;&gt;<\/code><\/li><\/ol><h2 class=\"wp-block-heading\">Performance Considerations<\/h2><h3 class=\"wp-block-heading\">CSS Size<\/h3><p>Theme.json-generated CSS is typically:<\/p><ul class=\"wp-block-list\"><li>Inlined in <code>&lt;head&gt;<\/code> (no extra HTTP request)<\/li><li>Deferred for editor styles<\/li><li>Cached after first generation<\/li><\/ul><h3 class=\"wp-block-heading\">Reducing Output<\/h3><p>Minimize CSS by:<\/p><ol class=\"wp-block-list\"><li><p><strong>Disable unused presets:<\/strong><\/p>\n<div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre class=\"wp-block-code language-json\"><code class=\"language-json\">{ &quot;settings&quot;: { &quot;color&quot;: { &quot;defaultPalette&quot;: false } } }\n<\/code><\/pre><\/div><\/li><li><p><strong>Limit preset count:<\/strong>\nFewer colors\/fonts\/sizes = less CSS<\/p><\/li><li><p><strong>Disable unused features:<\/strong><\/p>\n<div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre class=\"wp-block-code language-json\"><code class=\"language-json\">{ &quot;settings&quot;: { &quot;color&quot;: { &quot;duotone&quot;: [] } } }\n<\/code><\/pre><\/div><\/li><\/ol><h3 class=\"wp-block-heading\">Caching<\/h3><p><strong>Disable unused presets:<\/strong><\/p><ul class=\"wp-block-list\"><li>theme.json changes<\/li><li>User customizes global styles<\/li><li>Theme is updated<\/li><\/ul><h2 class=\"wp-block-heading\">Block-Level Variables<\/h2><p><strong>Limit preset count:<\/strong>\nFewer colors\/fonts\/sizes = less CSS<\/p><p><strong>Disable unused features:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{ &quot;settings&quot;: { &quot;color&quot;: { &quot;defaultPalette&quot;: false } } }<\/code><\/pre><\/div><p><strong>Disable unused presets:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{ &quot;settings&quot;: { &quot;color&quot;: { &quot;duotone&quot;: [] } } }<\/code><\/pre><\/div><h2 class=\"wp-block-heading\">Style Variations<\/h2><p><strong>Limit preset count:<\/strong>\nFewer colors\/fonts\/sizes = less CSS<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{ &quot;settings&quot;: { &quot;color&quot;: { &quot;defaultPalette&quot;: false } } }<\/code><\/pre><\/div><p><strong>Disable unused features:<\/strong><\/p><h2 class=\"wp-block-heading\">CSS Logical Properties<\/h2><p>WordPress caches the generated CSS. Cache is invalidated when:<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">json<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-json\"><code class=\"language-json\">{ &quot;settings&quot;: { &quot;color&quot;: { &quot;duotone&quot;: [] } } }<\/code><\/pre><\/div><p>Per-block settings create scoped variables:<\/p>","protected":false},"excerpt":{"rendered":"<p>How WordPress generates CSS from theme.json configurations. Overview WordPress processes theme.json and generates: CSS Custom Properties (variables) from settings Utility Classes for presets Global Styles from styles configuration Block Styles&#8230;<\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"footnotes":""},"tags":[],"project":[666],"project_type":[749],"class_list":["post-5855","documentation","type-documentation","status-publish","hentry","project-theme-json","project_type-wordpress-reference"],"project_info":{"id":589,"name":"WordPress Core","slug":"wordpress-core"},"project_type_info":{"id":749,"name":"WordPress Reference","slug":"wordpress-reference"},"_links":{"self":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation"}],"about":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/types\/documentation"}],"version-history":[{"count":3,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5855\/revisions"}],"predecessor-version":[{"id":11041,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5855\/revisions\/11041"}],"wp:attachment":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/media?parent=5855"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/tags?post=5855"},{"taxonomy":"project","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/project?post=5855"},{"taxonomy":"project_type","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/project_type?post=5855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}