Why are INLINE STYLES used in tags in some parts of Moodle?

Why are INLINE STYLES used in tags in some parts of Moodle?

by Mary Evans -
Number of replies: 11
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
It has become a source of annoyance whenever I want to change the background-colour of a particular 'box' I can't because it has an 'inline style' fixed to it. Is there a reason for this?

I would like to change the colour of that hideous pink background which is in the box which appears when you are about to delete a course, lesson, or whatever...

What is even more frustrating is that although I can see it in FIREBUG I can't locate it in the mod.php file...that's assuming I am looking in the right place! LOL

Is there anyone who can give me a clue? smile

Thanks

Mary
Average of ratings: -
In reply to Mary Evans

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
To change that "hideous" pink background to lifht blue, for example, just add the following at the end of any of your current theme's CSS files:
.box.noticebox.noticeboxcontent {background-color:#99ccff!important}
Joseph

Attachment image00.jpg
In reply to Joseph Rézeau

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Thank you Joseph...I much prefer the light blue!

smile

Mary
In reply to Mary Evans

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Frank Ralf -
Hi Mary,

Try something like this in your custom CSS file:

div.noticebox {
background-color: lime !important;
}

"!important" will give your style a bit more punch wink

hth
Frank
Attachment Overriding_inline_styles.png
In reply to Frank Ralf

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
LOL...I love the Lime Green caption!

Thanks for this Frank. I was always under the impression that 'inline styles' over-ride any other style type, but this works...so I have learned something new, so thanks for that too!

smile

Mary


In reply to Mary Evans

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Frank Ralf -
You could get even more fancy with the following CSS:

"The Return of the BLINK Tag!"

div.noticebox {
background-color: lime !important;
color: fuchsia;
text-decoration: blink;
}

(Perhaps not recommended for production use...)
In reply to Frank Ralf

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Thanks...that just made my day! Wake up call or what! LOL




Attachment rofl.gif
In reply to Mary Evans

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Inline styles are a hang-over from the bad old days. They are now against the coding guidelines and should be considered a bug. Indeed, if you find a specific instance, feel free to file it as a bug at http://tracker.moodle.org/. We are gradually getting rid of them all.
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
These were exactly my thoughts on finding that particular inline style. It's almost as bad as finding HTML font tags peppered here and there.

I'm still confused as to how one can get to the original file to delete that inline style. In fact there are some elements I want to change in the theme I am working on but don't seem to be able to find the correct file where the specific code is so that I can add some new classes or just change an odd thing or two.

As for your suggestion to record this particular problem as a 'BUG' is a good idea and will do just that. Thanks again.

Mary

In reply to Mary Evans

Re: Why are INLINE STYLES used in tags in some parts of Moodle?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
In Moodle 1.9 and before, themes cannot affect the HTML that is generated.

It will be possible (though not necessarily easy) in Moodle 2.0.