Lexi Smith
Lexi Smith

Reputation: 109

Justify Text in CSS

I'd like to align my blog post text so that the paragraph is flush on both sides by increasing letter spacing. Is there a way to do this in CSS? I've tried text-align: justify; and I've tried adding letter spacing properties. Neither seems to work. If anyone can point me in the right direction that would be great.

I'm very new to CSS but I work in print media, where it is called kerning. The spaces between the letters are selectively spaced to create more visually appealing text and the paragraph aligns on both sides. Right now I have created a track element, which just creates overall space between letters, which is not the same as kerning. I don't know what its referred to in programming though.

This is what I had:

.the-content {
width: 540px;
text-align: justify;
}

This is what worked:

#content p {
margin-bottom: 11px;
color: #555;
text-align: justify;

Upvotes: 5

Views: 10534

Answers (1)

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93484

More than likely, you're trying to justify an inline element, such as a span. Justification can only work when aplied to a block level element.

If you would like further help, then you will have to post an example of what you're doing.

Upvotes: 7

Related Questions