How to justify text in Firefox and Safari with CSS?
Asked Answered
C

3

7

In Chrome, on a paragraph element,

text-align: justify;

works fine and creates a block alignment, but has no effect in Firefox or Safari. Any suggestions?

Complexion answered 3/8, 2018 at 1:7 Comment(2)
This will help you: developer.mozilla.org/en-US/docs/Web/CSS/…Perjured
IE doesn't know unset. Use with caution.Thereupon
H
5

Set the white-space property to pre-line. It will force to collapse into a single whitespace and the text will wrap on line breaks. This will help to block align:

   white-space: pre-line;
Harbin answered 15/4, 2020 at 13:14 Comment(0)
H
0

Posting in behalf of the OP who posted the answer in comment

I believe I solved the problem:

 white-space: pre-wrap; 

was interfering so I used

white-space: unset; 

to solve the issue.

Harbin answered 3/8, 2018 at 1:7 Comment(0)
W
0

On paragraph element or <p> is block label element but DTD says it's contain inline element. If text-align: justify not working you have to check your browser user agent stylesheet. If p is display: block / inline-block; then text-align: justify; will work.

P{
    display: block; /* inline-block; */
    text-align: justify;
}

It will solve your Firefox and Safari issue.

Wrangle answered 8/3, 2020 at 14:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.