Totara Learn Open Discussions

Inline CSS into an HTML block

 
??
Inline CSS into an HTML block
?? 发表于 2018年04月25日 Wednesday 06:09
 

Does HTML blocks allow just inline CSS?

Thank you

Alessio

Craig Eves
Re: Inline CSS into an HTML block
Eves (Totara Support)Craig 发表于 2018年04月26日 Thursday 20:38
小组 Totara

Hi Alessio

The way to do this in the block is to allow additional CSS classes in the HTML block (Site admin > Plugins > Blocks > HTML - Allow additional CSS classes

Then add the HTML block to the page and there should be a box where you can enter the CSS class you want to change eg background

Then go into the theme for you site and add Custom CSS for example .background{background-color:#768f40;}

I tried in 11 and seemed to work but don't know if there is a better/easier way to do this.

regards

??
Re: Inline CSS into an HTML block
?? 发表于 2018年04月27日 Friday 00:55
 

Thank you for your reply Craig.

Can I add some CSS within <style></style>?

I tried to do it, but as soon as I click on save button, Totara delete all the code within those tags.

Craig Eves
Re: Inline CSS into an HTML block
Eves (Totara Support)Craig 发表于 2018年04月29日 Sunday 13:21
小组 Totara

Hi Alessio

This won't work as the code is stripped out by Totara to prevent malicious code being inserted.

regards

Craig

??
Re: Inline CSS into an HTML block
?? 发表于 2019年01月19日 Saturday 11:09
 

This is great information, thank you. I like that this will work for my HTML Blocks, but is there also way to add CSS to the HTML Editor within the Label Activity? Or does it all get stripped out by Totara?

Thanks,
Jim