Question:
How can multiple HTML code snippets be styled within Rich Content field without repeating CSS code?
Product:
Editor X
What are you trying to achieve:
I have designed a Tips panel that I use within Rich Content fields whenever I need to insert some sort of a tip relevant to content of a blog or guide that I’m working on. Here’s a screenshot of the tip panel as an example:
I use these panels all over my site! I have dozens of them and each live in HTML code block in Rich Content field. HTML code block consists of style
tag and corresponding HTML.
I recently needed to make a change to style of the Tip panel which meant I had to go through dozens of these embedded HTML code snippets and update style tag in every single one of them.
That took hours of my time and I’m just starting to build my site. I cannot imagine having hundreds or even thousands of these tips panels across all of the blog posts and guides that I will be creating and having to update style tag in all of them if I want to make a slightest style change.
With that as context, the question then is:
Is there a way to have the HTML code block inside of Rich Content field hold only HTML and store/manage relevant CSS code elsewhere?
This way if I would need to update styles in CSS, I would make a change in one place and all related HTML code blocks inside of all Rich Content fields would respond to the change automatically?
What have you already tried:
I already tried going to Settings > Custom Code in Wis Studio and adding the style
tag with all the relevant CSS styling to the head
element. That didn’t work because it looks like the HTML code inside of Rich Content field is rendered as an iframe
so the Tip panel doesn’t respond to CSS included in the head
element of my site.
I also tried adding the CSS for styling the Tip panel to the global.css
file that’s part of my Wix site. That didn’t work either. I’m guessing for the same reason - my site’s CSS doesn’t apply to iframes
.