NO BUG: ID changes to 'root' on template in custom CSS of page

Hi there,

Seems like there is a bug when using IDs on templates? My #post-content keeps changing to “root” within the custom code CSS on the Single Post Template.
CleanShot 2023-03-08 at 11.24.51

Hi Chris,
Thanks so much for your report!

Actually this is a feature :smiley: You can generally use the “root” keyword as a placeholder for the ID or selected class instead of writing it out, which is much faster in 9/10 cases.

Use the root placeholder to target the currently editing element. Bricks automatically converts this root placeholder to your element ID.

Source: Custom Code – Bricks Academy

Best regards,
timmse

It was replacing my #post-content with root on the page > Advanced > Custom CSS. I know it works at element level, but why would it replace an ID in my advanced CSS page settings?

Because your #post-content is still the root selector, no matter if in the custom css of the element or in the custom css of the page.

I think it would be more confusing if it works that way for one field and differently for the other, right?

@timmse I get what your saying, but this is happening at the page level, so wouldn’t root on the page level mean the entire page? It is changing my #post-content to root meaning that it is no longer selecting #post-content and referencing the page.

No, it doesn’t mean that. Generally, “root” in the page custom CSS is displayed as “root” only if you have selected the element. If you don’t have the element selected, it will still have your custom ID #post-content.

The styles for #post-content are still displayed, aren’t they?

1 Like

Ok. I didn’t fully understand that is how it worked. I thought you only use root within the element’s CSS. Thank you for clarifying. I can’t tell you how many times I changed root back to ‘#post-content,’ so this helps a ton.

They were, but because I thought this was a bug I didn’t look into it that far. I was more-so focused on the code editor.