Error when editing style "There was a problem while saving: Illegal element"

LabKey Support Forum
Error when editing style "There was a problem while saving: Illegal element" chelsea st germain  2023-04-14 15:19
Status: Active
 

I have been trying to add some style elements to my wiki web parts and the text itself works fine, but I try to throw in any style element and it throws an error saying "There was a problem while saving: Illegal element". I checked the html code on another site and the HTML code works fine elsewhere, so I dont' know why I'm getting the error.

Example code below:

<style>
.aligncenter {
text-align: center;
}
</style>

 
 
mohara responded:  2023-04-15 14:57

Hi Chelsea:

In order to be able to use tags like <style> in HTML-format wikis, you would need to have either the "Platform Developer" site level role (or with Premium Editions, the "Trusted Analyst" role also supports this operation). Learn about Developer Roles here.

However, there are other options for wiki styles like that. One alternative is to apply the style in-line. A non developer could include syntax like this in a wiki-syntax page:
{div:style=text-align:center}
Center this text.
{div}

Or in an HTML-syntax page, you use:
<div style="text-align:center;">
Center this text.
</div>

Another alternative is to include your styles in a custom CSS file that can be included at the site or project level. At least the Project Administrator role is required to apply the CSS to the project (or site), but once in place wiki editors gain the ability to use those named styles in wikis without having the developer or admin role. As an example, we use a "bluebox" style for instruction boxes in our documentation and show that example in the documentation here.

Hope that helps,

--Molly