Totara Learn Open Discussions

Inline CSS into an HTML block

 
? ?
Inline CSS into an HTML block
על ידי ? ? בתאריך 25/04/2018, 06:09
 

Does HTML blocks allow just inline CSS?

Thank you

Alessio

Craig Eves
Re: Inline CSS into an HTML block
על ידי Craig Eves (Totara Support) בתאריך 26/04/2018, 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
על ידי ? ? בתאריך 27/04/2018, 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
על ידי Craig Eves (Totara Support) בתאריך 29/04/2018, 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
על ידי ? ? בתאריך 19/01/2019, 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