Don't change formatting for standard html

Don't change formatting for standard html

by Gustav W Delius -
Number of replies: 23
A nice feature in the past was that one could copy and paste text from other web pages into the HTML editor and it would be displayed inside Moodle in its original form. Unfortunately the new style sheet redefines the formatting of standard html tags like <h1>, <th>, which breaks this.

I think the Moodle style sheets should only change the formatting for tags that have been given moodle class names or ids. So for example don't give all table headers a coloured background but only those created by Moodle.
Average of ratings: -
In reply to Gustav W Delius

Re: Don't change formatting for standard html

by Enrique Castro -
Picture of Core developers Picture of Particularly helpful Moodlers
I second that,

This easy copy-paste feature is praised among ULPGC teachers as a killer one. It saves lots of time. "traditional" teachers remain mostly "techno-skeptic", providing an easier path is essential to get them to this new world.  A fantastic selling point is if you offer a solution that actually saves time/work with respect to the traditional one .

- Enrique -
In reply to Enrique Castro

Re: Don't change formatting for standard html

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
The copy/paste features are still there and have not changed.
In reply to Martin Dougiamas

Re: Don't change formatting for standard html

by Enrique Castro -
Picture of Core developers Picture of Particularly helpful Moodlers
I know, of course.
What Gustav says is that appearance will not be maintained. Some colors change, some fonts. Minor points, but some people is really insistent on that points. They do not understand that Web is not a printer.

 Advanced teachers know that HTML is a tagged syntax, and know <b> and the like, or that images are linked and not embedded. But few realize that actual rendering takes place in each browser, and you have little control on it. They want the Web to behave as a printer or PDF: once created a page is the same ever for everybody. Even the reddish-violet  color tone they have been an afternoon deciding upon, and no other monitor on the whole earth can reproduce exactly!!
Explaining CSS to people without HTML-writing experience is a torture. That's why the former CSS, less-extensive, was more forgiving in this aspect.

Given the work  that is going into the new themes, I think it is worth to have it well done, well polished.  This is a minor point, not adding bell and whistles, but were Moodle has another opportunity to let shine its careful design.  

- Enrique -
In reply to Gustav W Delius

Re: Don't change formatting for standard html

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Having headings and tables look integrated with the main site is actually a feature  tongueout  it means your Moodle site won't look like a mish-mash of different styles.

If you don't want this to happen, you can easily add new entries into your own theme to override the Moodle styles within any modules or pages you like.
In reply to Martin Dougiamas

Re: Don't change formatting for standard html

by Gustav W Delius -
Martin, I am really speaking from experience:
  1. It does NOT look good to make all table header cells use the coloured background. It also does NOT look good to make all headings centered.
  2. When a teacher has prepared some content externally and then pastes it into the HTML editor to appear on Moodle the teacher really doesn't like it if his formatting is changed and he has no easy way to override it.
So could we please re-consider this "feature"?
In reply to Gustav W Delius

Re: Don't change formatting for standard html

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Headings

Headings should be easy to change since they all (should be) using print_heading() so I can add a separate class to the <h2> and make the style sheets use the "h2.main" selector rather than the plain "h2" (or not, depending on the theme-maker's preference). Easy to do and now done.

Tables

I don't think tables will be so easy, since they are not all done with print_table() - there will be lots of hardcoded <th> tags around the place, I think, and I for one don't have enough time or inclination to change that right now, especially since it is fixable in your own theme if you really want to do so. All you need to do is add a selector to your theme that targets, say, <th> tags within the discussion displays or the resource pages.

Finally, the HTML editor adds style tags that override all the stylesheets (eg see heading alignment in this post).
In reply to Martin Dougiamas

Re: Don't change formatting for standard html

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Actually, I looked at the TH tags and it's not so bad after all to do the main ones. I've made the class th.header (this needed a change in sideblocks from th.heading which will break any 1.5 themes you may be working on), but it does make it easier to change things across the site.

I'd appreciate some hunting by others (in latest CVS) to produce a list of table headings around the place that used to have the gradient backgrounds and now don't.

The idea of all this is that my preferred way and Gustav's way are as easy as possible to implement, so the theme designer can choose.
In reply to Martin Dougiamas

Re: Don't change formatting for standard html

by Samuli Karevaara -
True, that heading justification can be changed with the editor, but I second the motion that "centered" is not the best default for heading tags, leaving it blank or forcing to be "left" would be.
In reply to Martin Dougiamas

Re: Don't change formatting for standard html

by David Scotson -

Re: the table headers

I was just about to 'fix' this problem too, though I'm coming at things from a different position from Gustav's.

I'd noticed that just using th in the CSS to style table headers, affected all table header cells in the entirety of a Moodle site including those in user entered content.

I thought this was a bug because the style applied made the tabular content look like part of the Moodle interface (gradient background etc.) rather than part of the user entered content.

And talking of table headers, in the current style sheet system, the standard theme plays a dual role as a scaffolding for other themes and the default (and much nicer on the eye, imho) theme. Will these roles diverge into two sepearate themes, one with the basics and sensible default values designed to be overriden and another with the niceties, 'personality', and elements that require a bit of work to create and change (e.g. gradient backgrounds) of the standard theme?

At the moment you have to undo a lot of things before you can add your own styles e.g. changing the color of the table headers doesn't work because there is a background image over it. You need to both change the color and set background-image: none. It's also confusing, if you base your new theme on the default one nad start modifying it, that deleting styles has no effect as they are all duplicated.

In reply to David Scotson

Re: Don't change formatting for standard html

by Samuli Karevaara -
We had a lot of those similar confusing things: "were on earth does this get set"? Usually they are situations where a more detailed css path overrides a shorter one. For example, I set (in my mind) all TD contents to be red, for testing purposes:
td {
color: #ff0000;
}

Now, a lot of td's are not red. It's not the fault of the style or Moodle, just the way CSS works. If there is a style in the standard style sheet like
#contentblock td {
color: #00ff00;
}
then all these are blue though I thought I said that all TD's should be red.
In reply to Samuli Karevaara

Re: Don't change formatting for standard html

by John Papaioannou -
td {
color: #ff0000 !important;
}

wink
In reply to John Papaioannou

Re: Don't change formatting for standard html

by Samuli Karevaara -
Holy moly, works on IE too, thanks!

But it's a bit funny to have all of my own styles with the "!important" at the end smile

While on a coding mode, I read "!important" = "not important" smile
In reply to David Scotson

Re: Don't change formatting for standard html

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
This is not a lot of work to remove all the gradients at once:

th.header {
    background-image: none;
}

There may be a standardwhite later but standard really is meant to be very plain.

In reply to Martin Dougiamas

Re: Don't change formatting for standard html

by David Scotson -

Will that actually work? I've not tried it but thought, from a brief poke around, that the gradients were defined in multiple places with various levels of specificity (e.g. there's three references to gradient.jpg in styles_layout.css)

But it wasn't the amount of work for someone who knows what they are doing that bothered me (though I'll come back to that), it was more the surprise of someone who knows a bit of CSS and is savvy enough to duplicate and rename the folder and then starts to explore by changing things--finds that doing so works as expected--and then gets confused when deleting things from the CSS doesn't appear to have any effect.

Splitting it into two says clearly: here are the things you can and should change, and here are the things that you shouldn't (unless you really know what you are doing) and allows both deleting and changing of a line in the CSS of a duplicate of the standard theme to have an instant and obvious effect.

The other thing that I thought would be a roadbump for HTML/CSS hackers is the styles.php. I looked at the function in weblib but I'm still not sure what it's doing. Perhaps there is a way to do it with standard HTML/CSS techniques, in a way that would make sense to CSS jockeys.

Returning to the issue of effort to override, the one thing that did seem a lot of effort to get rid of was the Mozilla specific rounded corners. I was trying to duplicate the look of my University's front page (which doesn't use rounded corners) in a 1.5 theme, and eventually had to delete the styles_moz.css from standard theme as the thought of going through and neutralising each one in turn made my heart sink. (It also doesn't help that styles_moz.css prevents you from validating your CSS files as it uses non-standard CSS rules.)

Sorry, this turned into a bit of a mad ramble, I should really start threads as these ideas come to me.

In reply to David Scotson

Re: Don't change formatting for standard html

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
The code I gave should/will actually work (this is what I recently fixed further up in the thread).  There may be areas where it doesn't yet - I would like to know about them.

In your own theme/config.php do this to leave out the Mozilla stuff:

   $THEME->standardsheets = array('styles_layout', 'styles_font', 'styles_color');

I think coming up with a standard that allows ANY new superimposed styles to instantly work is going to be a bit tricky to get done ... particularly given the workload remaining in just getting basic stuff working for 1.5 and the small number of hands working on it, but I'll keep it in mind.
In reply to David Scotson

Re: Don't change formatting for standard html

by Urs Hunkler -
Picture of Core developers

Hi David and all,

"At the moment you have to undo a lot of things before you can add your own styles e.g."

This is the reason why I used the very wise feature to turn off cascading for the theme "orangewhite".

The 1.5 CSS cascading approach opens a wide variety of possible uses of CSS files. You find all settings needed in config.php:

  • you can specify the CSS files to use and the loading order
  • you can switch off cascading of the standard theme's CSS files completely
  • you can rely on any self defined "parent" theme - good for small changes

How to make some easy changes will be demonstrated and documented with some "child" themes of the standard theme like for example "standardwhite".

In reply to David Scotson

Re: Don't change formatting for standard html

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
By the way, all the header gradients are now out of standard and in standardwhite.  I think we should leave the new tab gradients in standard, though, because without them much of the tabs look is lost.

Here is the complete CSS code now for standardwhite:

th.header,
td.header,
div.header {    
    background-image:url(gradient.jpg);    
    background-position:top;   
    background-repeat:repeat-x;    
}

#nav-bar {
    background-image:url(gradient.jpg);    
    background-position:top;   
    background-repeat:repeat-x;    
}
 
In reply to Gustav W Delius

Re: Don't change formatting for standard html

by Samuli Karevaara -
I don't think that the copy'paste removes the teacher prepared formatting. If the original formatting is done with stylesheets, then it is changed when copied. But to match the selected Moodle theme, which in my opinion is nice. The defaults of the current standard theme might be fixed a little bit, though (hinthint)

I like how Firefox, for example, handles clean HTML. You might have extravagant styles with CSS, but if you copy'paste stuff in Firefox from a clean HTML/CSS page to MS Word, you get the MS Word default styles for everything. Then, if you apply your own template, you get everything the way you want smile
In reply to Martin Dougiamas

Re: Don't change formatting for standard html

by Mary Parke -
Could it be that if you copy paste from external sources preserving their formatting that you also disable the 508 compliance functionality of the html coding in moodle?  Just a thought.  
In reply to Gustav W Delius

Re: Don't change formatting for standard html

by N Hansen -
Gustav-It might require a tiny amount of instruction to the teachers as to how to do it, but couldn't they just cut and paste the html source from other web pages into the html editor in source view?
In reply to N Hansen

Re: Don't change formatting for standard html

by Gustav W Delius -
No, the problem is not with the html source but with the fact that Moodle will apply its own formatting.
In reply to Gustav W Delius

Re: Don't change formatting for standard html

by N Hansen -
If teachers are simply cutting a pasting from other sites, wouldn't it be better (and a little more in harmony with copyright law) if they just linked to the site as an external resource? thoughtful
In reply to N Hansen

Re: Don't change formatting for standard html

by David Scotson -
Linking in a frame may be the best solution overall, because otherwise you are relying on the end users to have a fairly sophisticated grasp of CSS. It seems likely that if people think they can cut and paste text and styles from external pages they will end up with various strange errors introduced by their own changes to the themes CSS, even if the Moodle provided CSS is smart enough to avoid this problem.