WeBWorK Main Forum

Adding CSS to many problems

Adding CSS to many problems

by Nathan Wallach -
Number of replies: 1
I have discovered the need to override some CSS code for all questions in Hebrew (ex. the code which places a radio button to the left of an item) as in Hebrew (a right to left language) it looks better on the left.

However, the same server may be hosting courses both in Hebrew and in English, and even in a Hebrew course there may be some problems in English, so ideally the "file" including these CSS changes should be included conditionally... so they don't fit well either as a "custom" theme for an entire course or in a math4-overrides.css file.

One option I am considering is a conditionally loaded file similar to math4-overrides.css which would be loaded when a particular language is set as the language of a specific problem, but this is quite a hack, and would probably misbehave on some types of "pages" which load several problems, and would add an extra conditional test in the templating system really only needed by right-to-left languages.

I would prefer to find a solution which would somehow effect only the "block" of HTML code for a single question at a time, if possible.

Does anyone have any experience with alternatives to override CSS in many PG files using an including macro file, somewhat like PGcourse.pl?

Nathan

References I am aware of:
In reply to Nathan Wallach

Re: Adding CSS to many problems

by Nathan Wallach -
Since I still have no suggestions or ideas for how CSS could easily affect only a specific HTML block, I settled for adding functionality to request the inclusion of additional CSS files in problem pages in 2 different manners (problem/PG level, and course level).

The code is in
and