搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

Wordpress "justify" not working

  • 5 回覆
  • 1 有這個問題
  • 23 次檢視
  • 最近回覆由 jonzn4SUSE

more options

I run a blog on WordPress and while editing a blog post I tried to "justify" the paragraph but it did not work. I previously used chrome in which it worked, but in Firefox it seems that its is not working.

附加的畫面擷圖

由 Najm Us Saqib 於 修改

所有回覆 (5)

more options

When I check both the Block editor and the Classic editor I have choices of Left, Center, and Right alignment. Are those the buttons that are not working for you? I'm attaching a screenshot of the buttons I'm referring to.

more options

I am talking about the block editor and attaching screenshot. The justify feature justifies the sentences in equal length. Other chromium based browser, this works.

more options

Your menu is different than mine. You must be using a plugin to add Justify to it. Maybe it's this one?

https://wordpress.org/plugins/block-options/

When I use that plugin to apply justify to a paragraph, I don't see any difference in the editor, but if I click Preview, then in the preview of the edited page, the paragraph is justified.

In the editor, the paragraphs are styled with

white-space: pre-wrap;

which appears to override or conflict with

text-align: justify;

Here's a basic demo for people who don't have a WordPress site: https://jsfiddle.net/f2bLq95s/

Potential Workaround

You could consider a style hack that would override the white-space rule. The plugin I tested adds "has-text-align-justify" to the list of classes for the paragraph, so a style rule could detect that and force white-space to normal for those paragraphs, allowing them to appear justified in the editor:

.has-text-align-justify {
    white-space: normal !important;
}

That gives the result in the screenshot.

That class name may vary depending on your plugin, and you also may need some guidance on how to apply this rule to your WordPress automatically.

Future Firefox Fix

I found a bug on file for this and updated it with a reference to this thread. Since most developers won't have a WordPress site, I provided some background information as well. There's no need to add any further comments at this time. Since this bug is five years old and does not yet have a priority assigned, you should not hold your breath for a fix in the immediate future.

more options

This is the major problem why people don't prefer using Firefox over chromium browsers. People here at Firefox don't fix problems as soon as they get it. I mean its five years old bug still it is not in their priority list (what a joke). There were lots of problems with Firefox when I started using it in Ubuntu. Even the YouTube live and twitter videos were not playing, I had to fix it myself by installing codecs, meanwhile this is not the case with chromium, I was able to play videos on chromium just out of box. Still thank you for your support.

more options

Have you tried a newer version of Firefox?

Operating System: openSUSE Tumbleweed 20201224 KDE Plasma Version: 5.20.4 KDE Frameworks Version: 5.77.0 Qt Version: 5.15.2 Kernel Version: 5.10.1-1-default OS Type: 64-bit Processors: 8 × Intel® Core™ i7-4810MQ CPU @ 2.80GHz Memory: 31.0 GiB of RAM Graphics Processor: Mesa DRI Intel® HD Graphics 4600