Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

how do you properly used text-align: justify; ? I think I might be trying to use it wrong

I'm trying to center a section with text-align: center; then styling a p tag with text-align: justify; with a margin of 15% to keep it centered, however its not working.

section { max-width: 100%;
          margin: auto;
          padding: 0;
          text-align: center;
          }
section p { max-width: 100%
           margin: 0 15%;
           text-align: justify;}```
ok ty sorry here's the code

please post the CSS you are having difficulty with. that way we can see your issue better.

I agree kinda need to see some code to be able to help.

Try padding the p text. Margin adds to the outside of the div and padding works on the inside.

5 Answers

I know this is not a real answer but try avoiding the usage of justify text, it creates a lot of rivers in the paragraphs and messes up with the design. Could you attach part of the code so I can check it out and see if there is a syntax error?

Since there is no code, I'm not sure of exact answer. Here's a complete guide on centering anything in CSS: https://css-tricks.com/centering-css-complete-guide/

i agree with all other guys as long as we do not have the code for the visuals its tricky to helpm you out but basically text-align: justfiy works well when you have text in a div container like the footer and you want the text to fit in well (justified) within the container equally spaced from all angles....guess that makes sense

I would center the text by adding the paragraph with text-align: justify the in a div and center the div.

Have you tried the css position property? .myClass { position: absolute; right: 20px; width: 200px; }