• Hi,
    I am trying to use global variables for the html tag but they are declared for the body tag and there are CSS cascading issues. Is there any filter to change the body tag to :root or html?

    Instead of this:

    <style id='global-styles-inline-css'>
    body {--wp--preset--color--background: #f8f5f2; [...] </style>

    I’d like it

    <style id='global-styles-inline-css'>
    :root {--wp--preset--color--background: #f8f5f2; [...] </style>

    Is it possible? I have hot no idea how to fix it.

    I’d appreciate your help. Thank you!
    Gyurmey

Viewing 4 replies - 1 through 4 (of 4 total)
  • The answer to your question depends on the theme you are using. Unfortunately, you have not mentioned that. It might be useful to contact its developer directly to answer your question.

    Thread Starter Gyurmey

    (@gyurmey)

    @threadi, thanks for the suggestions, but it has nothing to do with the theme you are using. Global styles are generated by WordPress core. It’s also about Full Site Editing which I didn’t mention.

    The body selector is unfortunately hardcoded in the WP_Theme_JSON class, which generates this code for block themes. If you want an adjustment here for future wordpress versions my recommendation would be to open a ticket here so that the wordpress developer community can take a look and evaluate it: https://core.trac.www.ads-software.com

    Thread Starter Gyurmey

    (@gyurmey)

    @threadi, thank you again. I did as you suggested.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Global styles’ is closed to new replies.