Adding style tags to HTML code

Adding style tags to HTML code

by Chris Howard -
Number of replies: 5

Hello everyone,

     I am running Moodle v2.3, and I am trying to create a custom page that uses some style attributes.  When I edit the html source and add the style tags and style attributes in the head section of my page, I can't get it to actually apply to the content.  When I go back into the html source to view the code, the style tags and head section are no longer there.  Is there a way that I can add custom style attributes in the head section of the html code without having to edit any of the css files for the theme.  Any help or suggestions on this would be great.  Thank you.

Chris Howard, Network/Systems Administrator

Average of ratings: -
In reply to Chris Howard

Re: Adding style tags to HTML code

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Chris,

How are you trying to create the HTML page? There is no way of adding styles to the head of a page unless you use the Additional HTML found in the Appearance section in Site Administration, here you can add custom CSS as you have direst access to the head section of your Moodle site.

You could always try disabeling the HTML Purifier in Admin settings. Although I can't think which setting that comes under.

To create a truely HTML only page you would have to do this outside of Moodle, as one would do normaly on a website, or if you have access add it to a subdirectory of your theme, then it would work. I have done this myself for one of the themes I created a couple of years ago. These all worked and linked via a menu in the header of the page, seperate to the custommenu.

HTH

Mary

In reply to Mary Evans

Re: Adding style tags to HTML code

by Chris Howard -

Actually, I am trying to insert a Google Docs form into my site, but I don't want to embed it because I want to customize the look and layout of the form.  I can do this by getting the html code from the live form, but when I insert the code, it is fairly basic.  I was trying to add the style section of my form into the html page, but like I said, the style tags get removed.  Your suggestion about creating an html page separate outide of moodle and just linking to it might be the only way, but I'm hoping I can find another solution as well.  Thank you for your help.


Chris Howard

In reply to Chris Howard

Re: Adding style tags to HTML code

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

You could try using HTML include in a Moodle generated page

In reply to Chris Howard

Re: Adding style tags to HTML code

by Kent Koven -

Chris -

Did you ever figure this out?  I'm new to Moodle and was trying to do the same thing.  I finally figured out that if you create a HTML block and then link to a sepearate CSS file, it will work.  You can't create <style> tags within the HTML editor because they get stripped out, but if you link to an external stylesheet, it works.

Just wanted to share.