Insert CSS into a moodle page

Insert CSS into a moodle page

by erotavlas erotavlas -
Number of replies: 4

Hi,

in the previous versions of moodle v2.7.x and v2.8.x that I used in the past, I could add a custom CSS code on top of a moodle page. Now I have moodle v3.8.2 and this way does not work any more. I enabled Administration->Plugins->Blocks->HTML->Allow additional CSS classes.

I would like to add the double underline mark via HTML.

<style type="text/css">
.doubleUnderline {
text-decoration:underline;
border-bottom: 1px solid #000;}
</style>

<span class="doubleUnderline">Test</span>

Any idea?
Average of ratings: -
In reply to erotavlas erotavlas

Re: Insert CSS into a moodle page

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I would expect that to work. If it did ot, I would try to work out why using the Developer tools in my web browser (e.g. confirm that CSS is in the head of the page, verify nothing is overriding it, etc.
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Insert CSS into a moodle page

by erotavlas erotavlas -
By analyzing the source code of the page I cannot find the custom CSS. I have the eguru theme and this is the code:
<link rel="stylesheet" type="text/css" href="URL/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple-min.css" /><script id="firstthemesheet" type="text/css">/** Required in order to fix style inclusion problems in IE with YUI **/</script><link rel="stylesheet" type="text/css" href="URL /theme/styles.php/eguru/1585575528_1/all" />

No errors in the console just three warnings.
Does moodle still use YUI library?

P.S. I tried with the classic theme, but the behaviour is the same:
<link rel="stylesheet" type="text/css" href="URL/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple-min.css" /><script id="firstthemesheet" type="text/css">/** Required in order to fix style inclusion problems in IE with YUI **/</script><link rel="stylesheet" type="text/css" href="URL/theme/styles.php/classic/1585575528_1/all" />
<script type="text/javascript">
In reply to erotavlas erotavlas

Re: Insert CSS into a moodle page

by erotavlas erotavlas -
I found that the CSS code is removed when I press save whereas if I insert standard HTML code it works well. The behaviour was different with the old version v2.7.x and v2.8.x.