Background color not working in HTML Editor

Background color not working in HTML Editor

by Chris Liang-Vergara -
Number of replies: 11
So here's a weird one....

I can't get the background color to work in the HTML editor. I'm able to change the font, size, and even the text color . . . but the background color never comes out (ie - appears). I've played around with directly editing the html, but it's as though it does not save the tags correctly.

For example...

1. After selecting text and choosing a bright green background, the html editor shows:
<span style="background-color: rgb(102, 255, 0);">*NOTE: You need Adobe Flash Player to view the demo.</span>
2. So I hit SAVE. But then after reloading the post the color doesn't appear.
3. I go back into edit the post, take a peek at the code, and the entire tag is gone:
<span>*NOTE: You need Adobe Flash Player to view the demo.</span>

Any ideas? This only started since I upgraded to 1.9.2

Average of ratings: -
In reply to Chris Liang-Vergara

Re: Background color not working in HTML Editor

by Ann Adamcik -
I've found that you have to enable HTML purifier to get backgrounds to work in the editor. See Site Administration->Miscellaneous->Experimental.
In reply to Ann Adamcik

Re: Background color not working in HTML Editor

by Chris Liang-Vergara -
Thanks Ann! You're a genius ... background colors are working fine.

I recall considering turning it on, but the "resource intensive" warning drew me away. At the moment, things seem to be running smoothly and quickly... so hopefully all is well.
In reply to Ann Adamcik

Re: Background color not working in HTML Editor

by Mary Ciccarella -

I am unable to change the background either. I am wondering if I have administration rights. There is no "Miscellaneous" in my menu in the administration block.

Here is my page:

http://moodle.boone.kyschools.us/course/view.php?id=263

In reply to Mary Ciccarella

Re: Background color not working in HTML Editor

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Your link (which I can't access) directs to a course page - the Miscellaneous option is on the front page site admin- if you can access that, then you are an administrator and should see the miscellaneous option. If you can't - you aren't! You wil not have it in the course admin block of an individual course.
In reply to Mary Cooch

Re: Background color not working in HTML Editor

by Al Martin -

To Mary Cooch,

I think I am in the same situation as Mary. I am the administrator for just one course on the Moodle platform at the institution where I work. Do you mean that because I am not the administrator of the whole platform I won't be able to change the background at all for my course?

Thanks,

Al

In reply to Ann Adamcik

Re: Background color not working in HTML Editor

by Lee Trampleasure -
I turned on HTML purifier and all my pages went blank, so I had to turn it back off.
In reply to Chris Liang-Vergara

Re: Background color not working in HTML Editor

by ian lake -

Another solution is to expand the editor, use 'table cells' for text and use table properties to set colours.

Ian 

In reply to ian lake

Re: Background color not working in HTML Editor

by Michael Sharpe -
I'm having a similar problem attempting to edit the background color. I've switch from using the html editor to using standard web forms. This helped with being able to directly control the code, but it still does not register the bgcolor change. I've also turned on the html purifier without success.

Any other suggestions for modifying the background color? Thanks in advance!
In reply to Michael Sharpe

Re: Background color not working in HTML Editor

by Mauno Korpelainen -

Michael, what version of moodle is it? I though this was fixed last December

 http://tracker.moodle.org/browse/MDL-16293

and all my test sites allow changing of background...testing:

 *NOTE: This background should be green.

In reply to Mauno Korpelainen

Re: Background color not working in HTML Editor

by Michael Sharpe -
1.9.x version of moodle

I was attempting to use the same code I used in Dreamweaver for a background color option (bgcolor=#xxxxxx) within the body tag. This was not working, so I switched to style="background-color: rgb(xxx, xxx, xxx);" which seems to work on everything so far.

Thanks for the response!
In reply to Michael Sharpe

Re: Background color not working in HTML Editor

by Mauno Korpelainen -

But...bgcolor=#xxxxxx can be used only in body tag. The bgcolor attribute specifies the background color of a document.

The background-color property sets the background color of an element.

You can use

color_name Specifies the background color with a color name, like red
hex_number Specifies the background color with a hex code, like #ff0000
rgb_number Specifies the background color with an RGB code, like rgb(255,0,0)

red - #ff0000 - rgb(255,0,0)

Code: <span style="background-color: red">red</span> - <span style="background-color: #ff0000">#ff0000</span> - <span style="background-color: rgb(255,0,0)">rgb(255,0,0)</span>