Moodle 2.2: Specifying the css for a table class in a label

Moodle 2.2: Specifying the css for a table class in a label

by Don Livingston -
Number of replies: 2

When modifying a table as part of a label, there is an option for including the class of a table.  Let's say I want a table with a blue background in each cell.  I put together a class like this:

table.blue td { background-color:  blue }

Where do I store the css lines so that it actually affects the table?  I've tried a dozen different locations and can't figure out the right place.


Dialog for general properties of a table in a label resource

Average of ratings: -
In reply to Don Livingston

Re: Moodle 2.2: Specifying the css for a table class in a label

by Developer@ Monarch Media, Inc. -

Hi,

There are two ways to achieve this:

1. Use Background color option under Advanced tab as shown in the below image

2. Add following class in /lib/editor/tinymce/editor_styles.css file and purge caches using System administration -> Development -> Purge all caches feature. Then the blue class will be available in drop down menu.

.blue
{
    background-color: blue;
}

Average of ratings: Useful (1)
In reply to Developer@ Monarch Media, Inc.

Re: Moodle 2.2: Specifying the css for a table class in a label

by Don Livingston -

Thanks, Developer!  (Claire?  Nandu?)...

Your post put me on the right track.  Following your advice I could indeed get css for a table to be properly reflected in the Tiny MCE editor.  However when the table was displayed outside of the editor (i.e. main course view), the styles vanished.  The cascade interfered somehow.

But apparently it was the aggressive caching that defeated me.  If I store the styles in theme/standard/style/core.css and then clear the cache, the style is reflected in course view.

In summary, for the style to appear as an option in Tiny MCE drop down style box and to express the style in the editor, it had to be included in editor_styles.css.  For the style to appear in a course view, it had to be stored in core.css.  And to get that all to be visible as I worked through them, I had to purge the caches.

Thanks again!  I doubt I would have figured out how to purge the caches otherwise,

Don.

Average of ratings: Useful (1)