Topic on Project:Support desk

Jump to navigation Jump to search

MediaWiki CSS in common.css works for Vector but not for MinervaNeue

9 (talkcontribs)

I have an RTL (right-to-left, Hebrew) MediaWiki 1.32.0 website with Vector as desktop theme and MinervaNeue as mobile theme.

In common.css I have added the following code to prevent <pre> LTR (left-to-right) content from moving to the right edge of the screen as all other content would in this RTL site. I gave this class to generally all <pre> tags in the web site.

.preLTR {
    direction: ltr;

The problem is that while <pre> content in Vector does go left, <pre> content in MinervaNeue doesn't (although it seems to be accepted in DOM)[1]:

  • Adding !important, saving and clearing cache doesn't help.

What can be the problem?

MarkAHershberger (talkcontribs)

@Amire80 has been super-helpful with RTL and CSS before. Perhaps he can help.

Amire80 (talkcontribs)

I'm not familiar with the "preLTR" class. Does this come from core MediaWiki or did you create it yourself? How did you apply this class to elements? Do you have a template?

Also, can I see this wiki online somewhere?

This post was hidden by 94rain (history) (talkcontribs)

@Amire80 At this point I prefer not to link to the website from anywhere.

  • The templates are Vector and Minerva
  • I created the class myself
  • I added the class this way:
    <pre class=".preLTR">
    Anyway, what seems to have been needed is to the add the above CSS class in:


After I have added it there, the problem seems no longer to exist.

Amire80 (talkcontribs)

If you only use this class to set the direction, then you should simply set it in HTML: <pre dir="ltr"></pre>.

W3C recommends not using CSS "direction: ltr" and using HTML attributes instead. (talkcontribs)

Everyone; sorry, I add a mistake above - it's <pre class="preLTR"> instead the dot-including <pre class=".preLTR">.

@Amire80 thanks for noting this recommendation - with due respect to W3C which I generally go by their recommendations, in this particular (rare) case I make an exception; in case I need to reverse and go by their recommendation I can do that by a category categorizing all pages with that class; I'm hard to believe will be a problem years ahead with this particularly. (talkcontribs)

with all due respect* (talkcontribs)

@Amire80 I take back what I wrote two passages before:

I had a problem I don't know how to explain were direction:rtl didn't give effect (even if !important was added) but dir="rtl" did;

I wrote something in Hebrew and right afterwards parenthesis with the English translation of the term; direction:rtl caused jumbling of characters while dir=rtl didn't.

I have removed the class preRTL and its calls, and instead use dir="ltr".

Reply to "MediaWiki CSS in common.css works for Vector but not for MinervaNeue"