Moodle and CSS

Moodle and CSS

by Kevin Burton -
Number of replies: 6

Sorry if this is such a basic question but I could not find the answer in the documentation. In the online documentation it suggests that there are three CSS files that are loaded. If I have CSS settings/definitions that are specific to my plugin where do those definitions go? Say I have a block plug-in such simiplehtml which the source would be in blocks/simplehtml. If I want a different font or color for the displayed HTML where should the CSS go?

Thank you.

Average of ratings: -
In reply to Kevin Burton

Re: Moodle and CSS

by Michael de Raadt -

Hi, Kevin.

The styles for your example block should be added to a styles.css file in the blocks/simplehtml directory. Keep the CSS specific to your block by preceding classes with the "frankenstyle" block identifier.

.block_simplehtml .your_class {...
Average of ratings: Useful (1)
In reply to Michael de Raadt

Re: Moodle and CSS

by Kevin Burton -

Michael,

Thank you for your help. It must be my limited understanding of CSS. Please help me in my ignormance. I have a styles.css that contains the following lines:

.block_simplehtml{ border: 1px red solid}

I change the width of the border, the color, etc. but nothing changes. With the debugging tools I can see that there is a <div> of the class block_simplehtml. What am I missing?

Thank you.

 

In reply to Kevin Burton

Re: Moodle and CSS

by Darko Miletić -
Picture of Core developers Picture of Plugin developers

Moodle by default caches all css styles. Switch your instance to theme designer mode which will disable css caching.

http://docs.moodle.org/dev/Creating_a_theme#Theme_designer_mode

Average of ratings: Useful (2)
In reply to Darko Miletić

Re: Moodle and CSS

by Kevin Burton -

I tried this and it did not affect the appearance. Am I trying to set a property that just does not show up?

In reply to Kevin Burton

Re: Moodle and CSS

by Darko Miletić -
Picture of Core developers Picture of Plugin developers

Did you empty your browser cache?

Are you sure that your block has that css listed in it's class attribute?

In reply to Darko Miletić

Re: Moodle and CSS

by Kevin Burton -

It is broken right now. I will get back to you after I get it back. Thank you for your help.