If I have a section of text with Hebrew characters:

    אאאאא <q>הללויה</q> פֿון לענאָרד כּהן אויף ייִדיש
          <q>הללויה</q> פֿון לענאָרד כּהן אויף ייִדיש

when the <q>…</q> is surrounded by other Hebrew text (the first line with the extra "אאאאא"), it works fine. But if the quote begins the paragraph, the first quotation mark gets put in the wrong place: enter image description here

The same thing happens with both Chrome and Firefox.

I can understand what causes this to happen (the initial <q> produces a quotation mark before any RTL characters are seen), and why the quoted word has to be at the "end" of the line rather than the "beginning" (HTML processes the elements left-to-right).

But what is the "correct" way of writing this HTML so that the quotation marks appear in the appropriate places? Is it even possible without CSS?

Added details:

  • The HTML does have <meta charset="UTF-8" />.
  • The text is simply the original title of something, to appear in a paragraph with other similar items (those are in Roman characters), so a blockquote wouldn't be appropriate. And even if it were, using blockquote makes no difference. It is the <q> that appears to be misbehaving.
  • For those interested, it translates to "Halleluja" by Leonard Cohen in Yiddish, which can be found on YouTube.

3 Answers 3


Is it even possible without CSS?

I suspect not. The browser is applying its own default styles - which include the direction of the text being left-to-right unless it can find a clue that this isn't the case.

But - as I'm guessing you already know - you can explicitly override the direction of the text with a single CSS style declaration.

p {
  direction: rtl;

You may want to consider using the blockquote tag for this type of functionality.

See details here.

You may also want to make sure that the HTML is set to the UTF-8 standard which includes Hebrew characters. You may have to use the hexcodes pertinent to these characters. This is probably going to be a better bet than just copying text over from a Hebrew text-editor.

More details of unicode as it pertains to the Hebrew language.

More details on how to use unicode in HTML.

  • The problem is with the behaviour of the <q>. The exact same problem occurs whether the larger container is a <p> or a <blockquote>. And putting only the song title itself into <blockquote> rather than into <q> wouldn't be appropriate in this situation. May 22, 2020 at 22:54

In fact, it is possible to get this correct using only HTML:

          Wrong: <q>הללויה</q> פֿון לענאָרד כּהן אויף ייִדיש
          Right: &#8207;<q>הללויה</q> פֿון לענאָרד כּהן אויף ייִדיש

enter image description here

Unicode provides a "right-to-left mark" character precisely for this purpose:

Using a Unicode right-to-left mark (RLM) or left-to-right mark (LRM) to mix text direction inline

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.