Predefining Default Style Values on the root tag of a Custom Elements

Is it possible, when creating a custom element, to ensure that certain style values associated with the root tag’s CSS ID are already specified?

Let’s imagine I place my new custom element in the builder. The root tag of this element already has its width set to 100%, but I can replace this value if I wish in the appropriate field.

A sort of default configuration associated with the element’s ID.

I hope I am clear.

Thank you.

I am wondering what you are trying to achieve, maybe you can post a example.

It sounds to me, like you want to set default values for your controls, which can be done inside the set_controlsmethod.

You also can enqueue custom scripts and styles via the enqueue_scripts method and add some custom styling to the auto-generated class bricks adds. This would be even easier to override, especially if you use a :where() selector.

1 Like

Sorry, it’s been a while, and I just saw your message. I don’t remember which project this was related to.

But after rereading my post, I think I was developing a new custom element (via code) and wanted certain default styles to be associated with its ID.

It doesn’t really matter anymore.

Maybe next time.