Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to justify text #113

Open
cwhittaker1000 opened this issue Jun 9, 2022 · 1 comment
Open

how to justify text #113

cwhittaker1000 opened this issue Jun 9, 2022 · 1 comment

Comments

@cwhittaker1000
Copy link

Thanks for creating this invaluable resource! Currently trying to put my own site together, and I'm struggling to figure out how to justify text i.e. add space between words so that both edges of each line are aligned with both margins (the equivalent of Ctrl + j in Microsoft Word).

In the _index.md file, currently I can specify text_align_left as true or false which toggles the text between being left and right aligned. But I can't figure out what I need to add/modify to get the text justified!

Any help would be massively appreciated! Thanks in advance!

@gadenbuie
Copy link
Collaborator

Hi! You'll need to create a new CSS rule in the assets/custom.scss file. This rule will likely work well for what you want:

.post-content p {
  text-align: justify;
  text-justify: inter-word;
}

The text-align property lines up both edges of the paragraph text and test-justify property sets how space is added into text of the line.

But there's a caveat. Justified text tends to look visually pleasing but reduces legibility and is discouraged by the W3C. Quoting from their guidance:

User Experience

This quote from a persona (fictional person) helps you understand some aspects of this guidance.

Persona: Parent with low vision – 20/400

Problem: “I increase the text size 400%. When text is fully justified, it gets big spacing between lots of words and scrunches up other words, making it hard to read."

What To Do

Usually nothing — if you don't mess with the justification, then it's good as is. In most situations, if you do not explicitly set the justification (for example, CSS text-align), it will default to left justification for left-to-right scripts and right justification for right-to-left scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants